Base64 Encoder & Decoder
Text ⇄ Base64 and image ⇄ Base64 data URI — in your browser, nothing uploaded.
Drop an image or browse
How to encode and decode Base64
- Text to Base64 — type or paste into the Plain text box and the Base64 appears beside it as you type.
- Base64 to text — paste into the Base64 box and the decoded text appears. Swap exchanges the two sides.
- Image to data URI — on the Image tab, drop in a picture and copy the
data:URI that results. - Data URI to image — paste a Base64 string or a data URI, tap Render image, and download the picture.
What Base64 is
Base64 is a way of writing any data — text, an image, a file — using only 64 safe characters: A–Z, a–z, 0–9, plus + and /. It exists because many systems were built to carry plain text and would corrupt raw bytes. Email attachments, JSON payloads, HTML and CSS files, and HTTP headers all rely on it.
It works by taking the data three bytes at a time, which is 24 bits, and cutting those into four groups of six bits. Each group, a number from 0 to 63, becomes one character. When the data does not divide evenly by three, = signs pad the end.
| Text | Base64 | Note |
|---|---|---|
Man | TWFu | Three bytes become four characters |
Hi | SGk= | Two bytes, one = of padding |
A | QQ== | One byte, two = of padding |
Base64 is not encryption
Anyone can decode Base64 in a second; it hides nothing. A password or API key that is “only Base64 encoded” is exposed. It is an encoding for transport, not a way to protect secrets. To check integrity use a hash, and to store passwords use a password hash.
It makes data a third bigger
Four characters for every three bytes means Base64 output is about 33% larger than the original. A 30 KB image becomes roughly 40 KB of text. That is the price of making it safe to paste anywhere.
When to embed an image as a data URI
A data URI looks like data:image/png;base64,iVBORw0… and can go wherever an image address would, in an img tag or a CSS background. It saves a network request, which helps for tiny icons and for single-file HTML emails or documents.
For larger images it is the wrong choice. The file gets bigger, the browser cannot cache it separately from the page, and the HTML or CSS around it becomes slow to load and awkward to edit. As a rule of thumb, embed only images of a few kilobytes, and shrink them first with the Image Compressor.
Variants you may meet
URL-safe Base64 replaces + and / with - and _ and often drops the padding, so that the result can sit in a web address; JSON Web Tokens use it, and the JWT Decoder reads them. This tool handles text as UTF-8, so accented letters, Indian scripts and emoji survive a round trip.
Encode text to Base64 or decode it back, and convert images to Base64 data URIs for embedding in HTML/CSS (or decode a data URI back to an image). It is UTF-8 safe and runs entirely in your browser, so nothing you paste is uploaded.
How do I encode text to Base64?
Type in the Plain text box; the Base64 appears live. Paste into the Base64 box to decode.
Does it handle emojis and accents?
Yes — it is UTF-8 safe, so 🎉 and café encode and decode correctly.
Is anything uploaded?
No. Everything runs locally in your browser.
More tools: QR Code Generator · Image Compressor