About this tool
Base64 turns any binary data into plain ASCII text using 64 characters — the standard trick for embedding images in CSS, attachments in email (MIME), or binary blobs in JSON. This tool converts both directions live as you type, handling Unicode correctly by encoding through UTF-8 (many older tools corrupt accents and emoji).
Drop a file into the right pane and it becomes a data: URI ready to paste into CSS or HTML — with a live preview for images. Paste Base64 into the left pane and, when it decodes to a known binary type, you can download it straight back as a file. It recognizes PNG, JPEG, GIF, WebP and other formats straight from the decoded bytes, so the preview and the correct file extension (like .png) show up automatically, even with no data: URI prefix. Everything happens on your machine: no upload, no size tracking, works offline after first load. More free tools at dec0de.dev, and the full story in What is Base64?
Typical uses: inlining small icons or fonts in CSS with data: URIs to save a request, embedding logos in HTML email, storing keys or certificates inside JSON and YAML config, and moving binary through text-only channels. The URL-safe option (RFC 4648 §5) swaps +/ for -_ so the string survives inside URLs and filenames, and line wrapping at 76 characters matches what MIME email expects. Because the output is plain text it survives copy-paste, chat and logs intact — but remember Base64 is not compression (the result is ~33% larger) and not security (it is trivially reversible).
Frequently asked questions
Is Base64 the same as encryption?
No. Base64 is an encoding, not encryption — it only reformats data and anyone can decode it instantly. Never use it to hide passwords or secrets.
Why is my Base64 output larger than the original?
Base64 represents every 3 bytes as 4 characters, so the encoded text is about 33% larger than the input. That overhead is the price of making binary safe as text.
Can I convert an image to Base64?
Yes. Drop an image (or any file) into the right pane and you get a data: URI you can paste straight into CSS or HTML. Images also show a live preview.
Can I turn Base64 back into a file?
Yes. Paste the Base64 (a data: URI works too — the prefix is stripped automatically) into the left pane. The tool sniffs the file type from the decoded bytes and offers a download with the right extension, plus a preview for images.
Is my data uploaded to a server?
No. All encoding and decoding runs entirely in your browser with JavaScript. Nothing you type or drop is sent anywhere, and it works offline after the first visit.
What is URL-safe Base64?
A variant that replaces + and / with - and _ (and often drops the = padding) so the string is safe inside URLs and filenames. Standard Base64 uses + and /. Toggle the URL-safe and Strip padding options above — decoding accepts either variant automatically.
What is Gzip + Base64 used for?
Compressing first and then Base64-encoding is how SAML authentication requests (HTTP-Redirect binding), many Kubernetes Secret values, and some log/telemetry payloads are transported as compact plain text. Turn on the Gzip option above: typed text gets gzip-compressed before encoding, and Base64 pasted into the left pane is gunzipped automatically after decoding.
Can I decode a Base64 string directly into a downloadable PNG?
Yes. Paste the Base64 into the left pane — with or without a data:image/png;base64, prefix, since the prefix is stripped automatically. The tool reads the decoded bytes to detect PNG (or JPEG, GIF, WebP and more), shows a live preview, and the “Download as file” button already has the .png extension filled in.