Good to know
How the encoding works
Base64 (defined in RFC 4648) reads your data three bytes at a time. Those 24 bits are split into four groups of 6 bits, and each group picks one of 64 characters: A–Z, a–z, 0–9, + and /. If the last group is short, = pads it.
length = 4 × ceil(n ÷ 3)
Here n is the number of input bytes. So 300 bytes become exactly 400 characters, a third larger.
A worked example
Hi!is 3 bytes and encodes toSGkh, with no padding.Hiis 2 bytes and encodes toSGk=, padded to four characters.éis one letter but 2 bytes in UTF-8, so it becomesw6k=.
Text is always turned into UTF-8 bytes first, so accents, Arabic, Chinese and emoji survive the round trip.
Standard or URL-safe
The standard alphabet uses + and /, which have special meanings in URLs. Base64url (RFC 4648 section 5) swaps them for - and _ and usually drops the padding. The bytes FB FF give +/8= in standard Base64 and -_8 in Base64url. JSON Web Tokens use Base64url.
When decoding, the tool accepts either alphabet, with or without padding, and ignores spaces and line breaks. A leading data:…;base64, prefix is removed for you.
Limits
- Files must be under 15 MB, because the whole file and its Base64 copy sit in your browser’s memory.
- Data URIs make pages heavier and cannot be cached on their own, so keep them for small icons and fonts.
- Line wrapping at 76 characters follows the MIME rules used in email (RFC 2045).