Different output between Powershell ToBase64String & Linux base64 Different output between Powershell ToBase64String & Linux base64 bash bash

Different output between Powershell ToBase64String & Linux base64


You need to use iconv to convert from UTF-8 to UTF-16 without a byte order mark:

$ echo -n 'BASE64' | iconv -f UTF8 -t UTF16LE | base64QgBBAFMARQA2ADQA

The UTF16LE causes it to omit the BOM.

See https://superuser.com/q/381056/4206, where someone asks about forcibly including the BOM, but you want the opposite, which -- conveniently -- is in the question.