Honestly, people will probably wonder why I didn’t know this already. Base64’ing a file and getting it onto your clipboard from the command line? It’s as easy as calling the base64 command and piping to pbcopy:-

 base64  | pbcopy