base64 encoding .txt file

Well, not really. Base64 encoding turns 3 bytes into 4. So you can do 3 bytes at a time.