Base64 Encoder and Decoder
Turn text into Base64 and back, with accents, ñ and emoji properly encoded in UTF-8. You can also turn a file or image into Base64 or a data URI to paste into HTML, CSS or JSON, and turn Base64 back into a file. Everything happens in your browser: nothing is uploaded.
Works anywhere in the world, wherever you are.
Base64 characters
Waiting for data
Type some text and its Base64 shows up instantly.
Base64
Base64 does not encrypt or protect anything: anyone can decode it. It is for moving binary data through places that only take text.
Your data never leaves your device: text and files are encoded and decoded in your browser, are not uploaded, are not in the Share link, are not saved and are not sent to analytics (nor is the file name). Close or reload the page and they are gone.
Related tools
JSON Formatter and Validator
Everyday
Pretty-print, minify and validate JSON, with the exact error line.
OpenCSV to JSON Converter (and JSON to CSV)
Everyday
Turn a CSV or Excel table into JSON, or JSON into CSV.
OpenUUID Generator
Everyday
Random v4 or time-ordered v7 UUIDs, 1 to 1,000 at once.
OpenSecure Password Generator
Everyday
Random passwords from 8 to 128 characters, in your browser.
OpenAbout this calculator
How to use it
Choose "Text → Base64" and type: the Base64 shows up underneath instantly. With "Base64 → text or file", paste some Base64 and see the text it carries; if it is not text but a file (an image, a PDF), the tool tells you what it looks like and lets you download it, and shows it if it is an image.
With "File → Base64", choose a file from your device, up to 10 MB. You can get it as plain Base64 or as a data URI (data:image/png;base64,…), ready for an <img> or a stylesheet.
"Copy result" puts it on your clipboard and "Download .txt" saves it. Below you see how many bytes went in, how many characters came out and how much it grew.
Example
The text “Hello, Puerto Rico!” takes 19 bytes and in Base64 becomes “SGVsbG8sIFB1ZXJ0byBSaWNvIQ==”, 28 characters long. Every 3 bytes are written as 4 characters, so Base64 is always about 33% longer, and the end is padded with = to complete a group of 4.
A lone “ñ” is “w7E=” and the 😀 emoji is “8J+YgA==”. In the URL-safe variant the same emoji becomes “8J-YgA”: + turns into -, / turns into _ and there is no trailing =.
Why UTF-8 matters
Base64 encodes bytes, not letters. To encode text it first has to become bytes, and the standard way on the web is UTF-8, where “ñ” is 2 bytes and an emoji is 4. JavaScript's btoa function, which many tools use, only takes characters up to code 255: an emoji makes it throw an error, and “ñ” is encoded as a single byte (Latin-1, “8Q==”) instead of UTF-8's 2, so other programs read it differently. This tool turns the text into UTF-8 first, so the Base64 it gives is the same Python, Java or the base64 command on Linux and Mac would give.
Decoding works the other way: the bytes are read as UTF-8. If they do not form valid UTF-8 text, they are treated as a binary file you can download.
Standard or URL-safe
The standard variant (RFC 4648, section 4) uses A–Z, a–z, 0–9, + and /, and pads with =. + and / mean something in web addresses and file names, so the URL-safe variant (section 5) swaps them for - and _, and usually drops the =. It is what JWT tokens and many URLs use.
When decoding you do not have to choose: the tool takes both, with or without trailing =, with line breaks (like email's, which wraps every 76 characters) and with a data: prefix if there is one. If something is not Base64, it tells you which character and on which line and column.
Your data stays with you
Text and files are encoded and decoded entirely in your browser. Nothing is uploaded to any server, nothing is in the "Share" link, nothing is saved on your device and nothing is recorded in the site's statistics, not even the file name. Reload or close the page and it is gone.
Important limitations
- Base64 is not encryption: anyone can decode it. Do not use it to protect passwords or private data.
- Files are capped at 10 MB: their Base64 would be over 13 MB of text, too much to handle smoothly on a phone. For a very long result, the page shows the first 100,000 characters; copy and download carry the full result.
- The type of a decoded file is recognized by its first bytes for common formats (PNG, JPEG, GIF, WebP, PDF, ZIP, GZIP, MP3, MP4, WOFF2 and ICO). If it is not recognized, it downloads as .bin and you can rename the extension.
- A preview is only shown for PNG, JPEG, GIF and WebP images recognized by their content.
Frequently asked questions
This calculation runs in your browser and is never sent to a server. Your last values may be saved on your device only, for convenience. Results are estimates and are not financial, tax, accounting or legal advice.