Base64: encode and decode
Text both ways, a file to Base64 or a data: URL, Base64 back to a file. Everything runs in the browser.
Text and base64
Type in either field, the other one updates. Text is encoded as UTF-8, so Cyrillic and emoji come out the same as in Python and Go.
File to base64
How Base64 works
Base64 writes bytes with 64 printable characters: every 3 bytes become 4 characters, so the text grows by a third. It has no key, and any decoder decodes the string. Text is first converted to UTF-8 bytes, so Russian letters and emoji come back without loss.
A file becomes a Base64 string or a data: address with a type, which is put into HTML and CSS instead of a link. A Base64 string can be saved back as a file. The page identifies the type from the first bytes and knows 17 kinds, including PNG, JPEG, WebP, PDF, ZIP and MP3.
FAQ
- Is Base64 encryption?
- No. It is a way of writing bytes as letters, and it decodes without a key. To hide text you need a password and a cipher: there is an encryption page for that.
- How is Base64URL different?
- In it the characters + and / are replaced with "-" and "_", and the = signs at the end are often dropped. This is how JWT parts and data in addresses are encoded. The "url-safe" checkbox gives this variant.