How to use the base64 Encoder & Decoder
- Choose whether to encode text into Base64 or decode Base64 back into text. The page opens decoding a sample string; switch to Encode to turn your own text into Base64.
- Tick URL-safe if the Base64 is used in URLs, file names or JSON Web Tokens (JWTs). When decoding, both variants are accepted automatically.
- Type or paste your input. The result appears below as you type.
- The result updates instantly as you type. There is no button to press.
- Use Copy result to copy the figures, or Copy link to share a link that reopens the base64 Encoder & Decoder with the same inputs.
How it works
Base64 is a way of writing any binary data using only 64 "safe" characters: A–Z, a–z, 0–9, + and /, with = for padding. It's used wherever binary data has to travel through systems designed for text: email attachments (MIME), data: URLs that embed images in HTML and CSS, HTTP basic authentication headers, JSON Web Tokens and many APIs.
The encoding takes the input three bytes (24 bits) at a time and splits them into four groups of 6 bits. Each 6-bit group, a number from 0 to 63, becomes one character. So Base64 output is always about 33% larger than the input, and padding characters fill the last group when the input length isn't a multiple of three.
Base64 works on bytes, not letters, so text must first be turned into bytes. This tool uses UTF-8, the standard encoding of the web. That means accented letters, non-Latin scripts and emoji all work correctly, whereas the browser's built-in btoa function fails on them. URL-safe Base64 (Base64url) replaces + and / with - and _ and drops padding, so the output can be used in web addresses and file names. Remember that Base64 is an encoding, not encryption: anyone can decode it.
Formula
Example
The text "Man" is the bytes 77, 97, 110, or 01001101 01100001 01101110 in binary. Regrouped into 6-bit chunks, that is 010011 010110 000101 101110 = 19, 22, 5, 46, which map to "TWFu". The emoji 👋 is 4 bytes in UTF-8 (F0 9F 91 8B) and encodes to "8J+Riw==", or "8J-Riw" in URL-safe form.
Frequently asked questions
Is Base64 encryption?
No. Base64 is a reversible encoding with no key, so anyone can decode it. Never use it to hide passwords or secrets.
Why does Base64 make data bigger?
Every 3 bytes become 4 characters, so the output is about 33% larger, plus up to two padding characters.
What does the = at the end mean?
It's padding. One = means the last group held 2 bytes, and == means it held 1 byte. URL-safe Base64 usually omits it.