This is because you do not see raw hash bytes, but rather Base64 encoding.
Base64 encoding converts a block of 3 bytes into a block of four characters. This works well if the number of bytes is divided by 3. If it is not, then you use a pad character, so the number of resulting characters is still divided by 4.
So:
(no of bytes)%3 = 0 => no padding needed (no of bytes)%3 = 1 => pad with == (no of bytes)%3 = 2 => pad with =
The SHA256 hash is 256 bits, it is 32 bytes. So you get 40 characters for the first 30 bytes, 3 characters for the last 2 bytes, and padding will always be one = .
source share