I would like to check my test code,
$ printf 'A\0B' | base64
$ printf 'A\0B' | base64 | base64 -d
$ printf "\n"
The null character, '\0', is missing.
It's there, but invisible. (
\0 is just an input mechanism; it's not what the null character actually looks like.)
To confirm this, you can pipe the output of that command to
less, which has a special way of depicting control characters.