3. Implementation Discrepancies
Base encoding implementations mainly differ in five areas: line feeds, padding, non-alphabet characters, alphabet selection, and canonical encoding.
3.1 Line Feeds in Encoded Data
Encoders MUST NOT add line feeds to base-encoded data unless the referring specification explicitly requires them. MIME and PEM line-length limits are rules for those formats, not general Base64 requirements.
3.2 Padding of Encoded Data
Encoders generally MUST include the appropriate pad characters at the end of encoded data unless the referring specification explicitly states otherwise.
3.3 Non-Alphabet Characters
Decoders MUST reject encoded data containing characters outside the selected alphabet unless the referring specification deliberately permits such characters, for example by ignoring whitespace.
3.4 Choosing the Alphabet
Different environments need different alphabets. Characters such as + and / are inconvenient in URLs and filenames, which is why RFC 4648 defines the URL and filename safe Base64 alphabet.
3.5 Canonical Encoding
Pad bits MUST be zero. Otherwise, the same binary data can have more than one textual representation, which breaks canonical comparison and can affect signatures or hashes.