Base64 Encoder and Decoder, Free and Private
Encode text or files to Base64 and decode Base64 back to text or a file in your browser. URL-safe alphabet, line wrapping, data URLs. Nothing is uploaded.
0 characters, 0 bytes
0 characters, 0 bytes
About the Base64 Encoder and Decoder
The Base64 Encoder and Decoder turns text or a file into Base64 and turns Base64 back into text or a downloadable file, entirely in your browser. Base64 is the way binary data travels through places that only accept text: email attachments, JSON payloads, data URLs in CSS and HTML, basic authentication headers, JWT tokens and configuration files. Paste or type on the left and the result appears on the right as you go. Nothing is uploaded, and your text and files never leave your device.
How to use it
Encode
- Keep Mode on Encode and type or paste your text, or press Choose file to encode a file of up to 50 MB.
- Turn on URL-safe when the result goes into a URL or a token:
-and_replace+and/, and the trailing=padding is dropped. - Turn on Wrap at 76 characters for MIME-style output with a line break every 76 characters. For a file, turn on Data URL to get a
data:URL ready for animgtag or a stylesheet. - Press Copy to copy the result.
Decode
- Switch Mode to Decode and paste the Base64. Whitespace, line breaks, missing padding and a leading
data:...;base64,prefix are all accepted. - Readable text appears on the right. If the bytes are not text, a Download decoded file button appears instead so you can save them.
- A bad character is reported with its position so you can find the typo.
Text data URIs and the ASCII check
- Choose Text to data URI to wrap text in a
data:text/plain;charset=utf-8;base64,...URI. Change the MIME type for HTML, CSS or JSON, or turn on Percent-encode instead of Base64 for a shorter, readable URI. - Choose Data URI to text to read the text back out of a Base64 or percent-encoded data URI. A data URI that holds an image or another binary type is offered as a download instead.
- Turn on ASCII only to have the first character above U+007F reported with its position, before encoding or after decoding.
Privacy
Everything happens in your browser. Your text and files are never uploaded to our servers, and decoded files are created on your device. Nothing is kept once you close or reload the tab.
What Base64 is and is not
Encoding, not encryption
Base64 is a reversible way of writing bytes with 64 printable characters. Anyone can decode it, so it hides nothing and protects nothing. If you need secrecy, use encryption; if you need to check that data has not changed, use a hash from the Hash Generator.
Why the output is longer
Every three bytes become four characters, so Base64 is about a third larger than the original. Padding with = rounds the last group up to four characters; the URL-safe variant leaves it off and decoders work out the length themselves.
Text is encoded as UTF-8
Letters outside ASCII, such as é or an emoji, are first written as UTF-8 bytes and then encoded, which is what web APIs, email and most programming languages expect. Decoding reverses the same steps.
Common uses
- Embedding a small image or font in CSS or HTML as a data URL.
- Reading the payload of a JWT, whose header and body are URL-safe Base64 without padding.
- Putting binary data such as a certificate or a key into JSON or YAML.
- Checking what an email attachment or a
Content-Transfer-Encoding: base64block contains.
Related tools
The URL Encoder and Decoder handles percent-encoding, which is the other way text is made safe for URLs. To see the bytes behind text as binary or hex, use Text to Binary. The Hash Generator computes MD5 and SHA checksums of the same text or file. Looking only to decode? Go straight to Base64 Decode.
Frequently asked questions
Is Base64 a form of encryption?
No. Base64 is a reversible way of writing bytes with 64 printable characters so they survive systems that only handle text. Anyone can decode it instantly, so it hides nothing. Use real encryption for secrecy and a hash to detect tampering.
Why does the Base64 output end with equals signs?
Base64 works in groups of three bytes that become four characters. When the input length is not a multiple of three, the last group is padded with one or two equals signs to keep the length a multiple of four. The URL-safe option leaves the padding off, and the decoder here accepts input with or without it.
What is the difference between standard and URL-safe Base64?
Standard Base64 uses plus and slash, which have special meanings in URLs and file names. The URL-safe alphabet replaces them with a hyphen and an underscore and usually drops the padding, which is why JWT tokens and many web APIs use it. Both alphabets decode to the same bytes.
Why is my decoded Base64 not readable text?
Because the original data was not text. Images, PDFs, archives, certificates and keys are often shipped as Base64, and decoding them gives raw bytes that no text encoding can display. In that case the page offers the bytes as a file download instead of showing symbols.
Are my files uploaded when I encode them to Base64?
No. The file is read in your browser and encoded there; nothing is sent to a server. The page makes no network request with your data, so it works offline once loaded, and the result disappears when you close the tab.