How to use the Base64 Encode / Decode
- 1
Choose Encode or Decode. Paste text into the left pane, or drop any file onto it to encode the file's bytes.
- 2
For encoding, pick URL-safe for tokens and query strings, Wrap at 76 for MIME email bodies, or Data URL to get a ready-to-use data:...;base64, string.
- 3
For decoding, paste standard or URL-safe Base64, with or without padding and line breaks, or a whole data: URL. Text appears on the right; binary data gets a Download button and an image preview.
- 4
Press the swap button to turn the output into the new input and reverse the direction.
- 5
Copy the result, or download it as a text file or as the decoded binary.
Features
- Encodes and decodes UTF-8 text correctly, including accents and emoji
- Encodes any file (images, PDFs, fonts) by drag and drop, up to 10 MB
- Standard and URL-safe alphabets, optional 76-character line wrapping, data URL output
- Decodes input with missing padding, stray whitespace or a data: prefix
- Detects binary output, sniffs PNG, JPEG, GIF, WebP, PDF, ZIP and gzip, and offers a download with the right extension
- Shows an inline preview when the decoded data is an image
- Recognises pasted Base64 and switches to Decode automatically
- Runs entirely in your browser; nothing is uploaded
Base64 in plain terms
Base64 is a way of writing bytes as text. Every 3 bytes become 4 characters drawn from A to Z, a to z, 0 to 9, plus and slash, with equals signs padding the end. The result survives any system that handles text, which is why email, JSON, HTML data URLs and HTTP headers all lean on it. It is not encryption and it is not compression; it makes data a third larger and hides nothing.
This tool handles the everyday cases: a string that needs to go into a header, a token that needs to be read, an image that needs to become a data URL, and a data URL that needs to become a file again. It understands both the standard and the URL-safe alphabets, forgives missing padding and line breaks, and tells you when the decoded bytes are binary rather than text.
Files and data URLs
Drop a file onto the input pane to encode its bytes. Turn on Data URL and the output is prefixed with the file’s MIME type, ready to paste into an src attribute or a CSS url(). Going the other way, paste a data URL and the tool strips the prefix, decodes the payload, previews it if it is an image and offers it as a download with a sensible extension.
Related tasks
Base64 is one layer of a JWT; the JWT Decoder shows the claims directly. For percent-encoding in URLs rather than Base64, use the URL Encoder, and for escaping text in HTML use the HTML Entity Encoder.
Frequently asked questions
What is Base64 used for?
Why is the encoded text about a third larger than the input?
What is the difference between standard and URL-safe Base64?
Can I decode a Base64 image or PDF?
Why does decoding say the result is not UTF-8 text?
Is my data uploaded anywhere?
Last updated .