Base64 Encoder and Decoder
Convert text or files to Base64 and back — including Base64 to PDF, image or any other file, with a preview and a download. Handles UTF-8 properly and supports the URL-safe alphabet.
What the Base64 Encoder and Decoder does
- Encodes and decodes Base64 in both directions, handling UTF-8 correctly, so emoji and accented characters survive.
- Supports the URL-safe alphabet, restoring padding automatically when decoding.
- Converts files and images into Base64 and complete data URIs, with a preview for images.
- Decodes Base64 back into the file it holds — a PDF, PNG, JPEG, audio or anything else — identifies the type from its bytes, previews it and lets you download it.
- Swaps the result back into the input in one click, so you can check a round trip.
What it doesn't do
- It doesn't encrypt anything. Base64 is an encoding, not a cipher — anyone can reverse it.
- It doesn't compress. Base64 makes data roughly a third larger.
- It doesn't decode Base64 that has been compressed or encrypted first.
Frequently asked questions
Is Base64 encryption?
No, and treating it as such is a real security mistake. Base64 is a way of representing binary data as text so it can travel through systems that expect text. It provides no secrecy whatsoever — this page decodes it instantly, with no key.
What is URL-safe Base64?
Standard Base64 uses + and /, which have special meaning in URLs, and = padding, which is awkward in a query string. The URL-safe variant substitutes - and _ and usually drops the padding. JSON Web Tokens use this variant, which is why a JWT contains no plus or slash characters.
Why does my decoded text look like nonsense?
Most likely the data isn't text at all — an image or other binary file decodes to bytes that aren't valid UTF-8. Use the Decode file tab for binary data. It can also mean the input was URL-safe Base64 decoded as standard, or the reverse.
Should I embed images as Base64 data URIs?
For small icons it saves a network request. For anything larger it's usually a loss: the data is about a third bigger, it can't be cached separately from the page, and it delays first render. Reach for it sparingly.
How do I convert an image to Base64?
Open the Encode file tab and drop in the image. You get the raw Base64 string and a complete data URI beginning with data:image/…;base64, which you can paste straight into an <img> src or a CSS url(). A preview confirms it's the right file, and nothing is uploaded.
How do I convert Base64 to a PDF?
Open the Decode file tab and paste the string — with or without a data:application/pdf;base64, prefix, and quotes left over from JSON are ignored. A Base64 PDF always begins with JVBERi0, which is %PDF once decoded. The PDF previews on the page and downloads with one click. If it won't open, the string was almost certainly cut short when it was copied out of a log or an API response.
How do I convert Base64 to an image?
Paste it into the Decode file tab. The format is worked out from the decoded bytes rather than guessed, so you get a PNG, JPEG, GIF, WebP or SVG with the right extension, a preview, and a download button. You can recognise the common ones by how the string starts: iVBORw0 is a PNG, /9j/ a JPEG and R0lGOD a GIF.
How do I decode a Base64 string to text?
Paste it into the Text tab and choose Switch to decoding. The result updates as you type. If the string contains - or _ rather than + or /, it's URL-safe Base64 — turn on URL-safe and it will decode, with any missing = padding restored automatically.
Why does Base64 end with = or ==?
Base64 turns every three bytes into four characters. When the input isn't a multiple of three bytes long, the last group is padded with one or two = signs so the length still divides by four. They carry no data, which is why the URL-safe variant usually leaves them off.