Base64 & data URI encoder / decoder
Encode and decode Base64 text, or convert any file to a data URI, entirely in your browser, with no upload.
Base64 encoding, decoding and file reading all run in your browser. Nothing is uploaded and the tool works offline. Base64 is an encoding, not encryption; don't use it to protect secrets.
What is Base64 encoding?
Base64 is a way to represent binary data using only 64 printable ASCII characters: A–Z, a–z, 0–9, plus + and /. Every three bytes of input become four Base64 characters, which is why the encoded text is always about a third larger than the original. It exists so that binary content (images, fonts, encrypted blobs) can travel safely through channels built for plain text, such as email (MIME), JSON payloads and data URIs. Base64 is not encryption: it hides nothing and anyone can decode it in a second, so never use it to protect passwords or secrets.
What is a data URI?
A data URI packs a whole file directly into a URL. The format is data:[mediatype][;base64],[data]. For example, data:image/png;base64,iVBORw0KGgo… Instead of linking to a separate file, you embed the bytes inline, so a small icon, font or SVG can live right inside your HTML or CSS with no extra network request. The trade-off is size: Base64 adds roughly 33% overhead, inlined assets cannot be cached separately, and large files bloat your document. Data URIs shine for tiny, rarely-changing assets and for self-contained pages that must work offline.
Standard vs URL-safe Base64
Standard Base64 uses + and / and pads the end with = signs. Those three characters cause trouble inside URLs and filenames, where + can mean a space, / is a path separator and = starts a query value. URL-safe Base64 (RFC 4648 §5) swaps + for - and / for _, and usually drops the = padding. Turn on the URL-safe option before encoding when the result will live in a link, a query string, a JWT or a filename. When decoding, this tool accepts both variants automatically and restores any missing padding, so you rarely have to think about it.
Is this tool private and offline?
Yes. All encoding, decoding and file reading happen inside your browser with native APIs. Nothing is ever uploaded to a server, and the page keeps working with your connection switched off. That makes it safe for pasting internal text or dropping in files you would not want to send anywhere. Just remember the golden rule: Base64 is encoding, not security. If you can read this page, so can anyone who gets hold of your encoded string.
Frequently asked questions
Is Base64 the same as encryption?
No. Base64 is a reversible encoding, not encryption. It uses a public, fixed alphabet, so anyone can decode a Base64 string instantly. This very page will do it. Never rely on Base64 to hide passwords, tokens or other sensitive data.
Why is the Base64 output bigger than the original file?
Base64 represents every three bytes with four characters, a fixed 33% expansion, plus one or two padding characters at the end. So a 300 KB image becomes roughly 400 KB of text. That overhead is the price of moving binary data through text-only channels.
Are my text and files uploaded to a server?
No. Everything runs locally in your browser using the FileReader and TextEncoder APIs, so your text and files never leave your device and the tool works completely offline. You can encode confidential content without it touching a server.
How do I turn an image into a data URI?
Switch to File mode and drop or choose an image. The tool reads it and shows the full data:image/…;base64,… URI along with a live preview. Copy the string and paste it into an HTML src attribute, a CSS background-image or an SVG to embed the image with no separate file.
Why does decoding show an error or garbled text?
Decoding fails when the input has characters that are not valid Base64, when the length is wrong because padding was stripped, or when the decoded bytes are not valid UTF-8 text. Remove stray spaces, check for a truncated string, and make sure you are decoding text rather than binary such as an image.