AES is a block cipher with 128-bit block (regardless of its key size of 128, 192 or 256 bits); that is 16 octets. PKCS#7 padding adds from one octet to a full block. It thus transforms $n$ octets of plaintext into $16\lfloor n/16+1\rfloor$ octets of padded plaintext, where $\lfloor x \rfloor$ $x$ rounded down to integer. Equivalently, the padded size is $n+16-(n\bmod 16)$ octets. In C(++), Java or Go, that's (n|15)+1
.
Size of the ciphertext when enciphering in CBC mode is typically larger, because secure use of the CBC mode requires an IV, typically included in the ciphertext, often 8 or 16 octets. With openssl enc -aes-256-cbc
the IV is 8 octets, but there is also an 8-octet header (Salted__
in ASCII). So in the end the ciphertext is 16 octets more than the padded plaintext. Again, that depends on the program.
There's no reason that the output size be a power of two in CBC mode, and it usually is not.