Decoding Base64 without newlines

So, I was trying to decode some base 64 encoded data to verify a request’s details but openssl kept returning nothing. To see what it expected I encoded a random string and when I saw the output it dawned on me. Base 64 wraps lines of a certain length with new line characters, every 64 characters (bytes, actually).

Wrapping data isn’t that hard, but I suspected there had to be a command that already did something like that. The answer was fold. It wraps lines of input to fit a specified width. The default was 80, but it can be changed with the -w switch. The result is:

 input | fold -w 64 | openssl base64 -d | output