ÆON Toolhub

Base64 Encoder / Decoder

This free Base64 tool encodes and decodes in your browser. Paste text, or drop an image or file, and get Base64 plus a ready data URI with CSS and HTML snippets. Decoding accepts line-wrapped Base64 and full data URIs, previews images, and lets you download them. Nothing is uploaded.

Base64
Input
25 B
Base64 out
36 B

Base64 is +44% larger than the original. Around 33% is expected, plus padding.

What is Base64 actually for?

Base64 solves one problem: moving bytes through a channel that only accepts text. It takes any data and rewrites it using 64 characters that survive almost anywhere, so binary content can travel where only plain text is allowed.

That comes up constantly. Email attachments are Base64 inside the message body. Images get embedded in CSS and HTML as data URIs. API payloads carry files inside JSON. Certificates and keys ship as PEM, which is Base64 wrapped in header lines. Session tokens and JWTs are Base64 segments joined by dots.

How do I encode and decode here?

Choose Encode or Decode, then give the tool something to work with.

  • Encoding text — paste it in the left box and the Base64 appears instantly on the right.
  • Encoding a file or image — switch the source to "File or image" and drop the file in. You get the raw Base64, the complete data URI, a CSS background-image rule, and an HTML img tag, each on its own tab with a copy button.
  • Decoding — paste the Base64 on the left. If it decodes to text, you see the text. If it decodes to a file, you get the detected type, the size, the pixel dimensions for images, a preview, and a download button.

The URL-safe switch matters when the result goes into a link or a filename. It swaps + for -, / for _, and drops the = padding, which are the three things that break Base64 inside a URL.

Why does line-wrapped Base64 fail on other tools?

Because a lot of tools count the line breaks when they calculate padding, then reject a string that was perfectly valid.

Base64 from the real world is almost always wrapped. MIME wraps at 76 characters, PEM certificates wrap at 64, and email clients wrap wherever they please. This tool strips every space, tab and newline before it does anything else, so a certificate pasted straight out of a terminal decodes normally. It also accepts a full data:image/png;base64,… string with the prefix still attached, which is what you get when you copy an embedded image out of browser dev tools.

Encoding is not encryption

Base64 protects nothing. It is a reversible representation, not a cipher, and anyone can decode it in one step, exactly as this page does. If you found a Base64 string in a config file and it looked scrambled, it is not secret; it is just packaged.

The confusion is common enough to cause real incidents. Credentials "hidden" in Base64 inside a repository, a mobile app bundle, or a browser payload are plain text with extra steps. Use real encryption when something must stay private, and reach for Base64 only when the job is transport.

How much does Base64 cost you in size?

About a third. Every three bytes become four characters, so the output is roughly 133 percent of the input, plus up to two padding characters. This page shows both sizes and the exact difference, so you can decide with a number instead of a guess.

That overhead is the whole argument about embedding images in CSS. A 2 KB icon becomes about 2.7 KB of text, which is a fine trade for removing a network request. A 400 KB photograph becomes roughly 533 KB that cannot be cached on its own and delays the stylesheet from rendering. Small and static, embed it. Large or reused, keep it as a file.

Does Unicode survive the round trip?

Yes, because the encoding runs through UTF-8 rather than the browser's older byte-by-byte path. Accented letters, Greek, Cyrillic, Chinese, and emoji all come back exactly as they went in.

This is where a lot of quick Base64 snippets break. The classic one-liner using btoa throws an error the moment it meets a character above the Latin-1 range, which is why so many scripts fall over on a simple é or a 🚀. Encoding the text to UTF-8 bytes first, then converting those bytes, is the correct order, and it is what happens here.

Does anything leave my browser?

No. Text, files and images are all processed locally with JavaScript, using the browser's own file reader and text encoder. There is no upload, no server call, no logging and no storage, and the page keeps working offline once it has loaded.

That makes it safe for things you should not paste into a random website: internal API responses, private keys, signed tokens, customer documents. Files are capped at five megabytes, not for privacy but because a data URI that large makes the page sluggish, and a clear message is better than a frozen tab.

Frequently asked questions

What is Base64?

Base64 is a way to represent binary data or text using only 64 safe characters: letters, digits, and a couple of symbols. It is used to embed images in CSS or HTML, send data in JSON and APIs, encode email attachments, and store tokens, anywhere raw bytes need to travel as plain text.

Is Base64 encryption?

No. Base64 is encoding, not encryption. It scrambles nothing and hides nothing; anyone can decode it back instantly, exactly as this tool does. Never use Base64 to protect passwords or secrets. Its only job is to package data in a text-safe form, not to keep it confidential.

How do I convert a Base64 string to an image?

Switch to Decode and paste the string, with or without the data URI prefix. The tool decodes the bytes, recognises the format from its signature, shows a preview with the real pixel dimensions, and offers a download with the correct file extension. Everything happens in your browser.

How do I turn an image into a data URI?

Choose Encode, switch the source to "File or image", then drop your file in. You get the raw Base64, the complete data URI, a CSS background-image rule, and an HTML img tag, each ready to copy. Files up to five megabytes are accepted so the page stays responsive.

Why does my Base64 say it is invalid?

Usually a stray character crept in during copying, or the string was truncated. Line breaks are fine here: Base64 from emails, MIME parts and PEM certificates arrives wrapped across lines, and this tool strips that whitespace before decoding rather than rejecting the input.

How much bigger does Base64 make a file?

About 33 percent bigger, because every three bytes become four characters, plus up to two padding characters at the end. The tool shows the exact sizes before and after so you can judge whether embedding is worth it. A 100 KB image becomes roughly 133 KB of text.

Should I embed images as Base64 in CSS?

Only for small assets like icons, tiny logos or single-pixel patterns. Embedding saves a network request but inflates the file by a third, cannot be cached separately, and blocks the stylesheet from rendering until it is parsed. For anything large, a normal image file wins.

What is the URL-safe option?

Standard Base64 uses the + and / characters and = padding, which have special meanings in URLs and file names. The URL-safe variant replaces + with - and / with _ and drops the padding, so the result can go into a link, a query string, or a filename without being escaped or broken.

Does it handle emojis and accents?

Yes. The tool encodes and decodes using UTF-8, so accented letters, emojis, and any other Unicode characters survive the round trip intact. Many quick Base64 scripts break on these; this one uses the browser's text encoder to get them right every time.

Are my files uploaded anywhere?

No. Files are read with the browser FileReader API and never leave your device, and decoding happens entirely in JavaScript. There is no server, no logging, and no storage, so you can safely handle private documents, internal assets, and API payloads. It works offline once the page has loaded.

Last updated: September 17, 2026