See Stéphane Chazelas's answer for a better solution.
* * *
You can use `/dev/stdin` to read from standard input
b64decode()
{
if (( $# == 0 )) ; then
base64 --decode < /dev/stdin
echo
else
base64 --decode <<< "$1"
echo
fi
}
* `$# == 0` checks if number of command line arguments is zero
* `base64 --decode <<< "$1"` one can also use `herestring` instead of using `echo` and piping to `base64`