How to use it
- Pick Encode to turn text or a file into Base64, or Decode to turn Base64 back into text.
- Type or paste your input, or choose a file when encoding. The result appears as you type.
- Use the standard alphabet unless the Base64 will go into a web address, a file name or a token. For those, choose URL-safe.
- If the decoded data is not text, such as an image, the tool shows it as hexadecimal. Use Download decoded file to save the original bytes.
When to use it
- Decoding a Base64 string from a log, an email header, a configuration file or an API response to see what it holds.
- Encoding a short text or a small file so it can sit inside JSON, XML, HTML or an email.
- Reading or building the
Authorization: Basicvalue for a test request. - Converting between standard and URL-safe Base64.
- Turning a data URL back into the original file.
How Base64 works
Base64 rewrites binary data using only 64 safe characters. Computers store data in 8-bit bytes. Base64 reads the bytes as one long string of bits, cuts it into 6-bit groups, and writes each group as one character, because 6 bits can hold exactly 64 values. Three bytes (24 bits) become four characters. If the data does not fill a whole block of three bytes, the last group is padded with zero bits and the output is topped up with one or two “=” signs so its length is a multiple of four.
Decoding reverses the steps: each character becomes six bits, the bits are regrouped into bytes, and any padding bits at the end are discarded.
Worked example. The text Man is the bytes 4D 61 6E, which is the 24 bits 01001101 01100001 01101110. Regroup them in sixes: 010011 010110 000101 101110. The values are 19, 22, 5 and 46, which the standard alphabet writes as T, W, F and u. That gives TWFu.
The longer text Hello, World! is 13 bytes. Thirteen is not a multiple of three, so the last block holds one byte and ends in two padding signs: SGVsbG8sIFdvcmxkIQ==, which is what the tool shows when it opens.
Standard and URL-safe Base64
The standard alphabet uses the letters A–Z and a–z, the digits 0–9, and the symbols + and /. Those two symbols have special meanings in web addresses and file paths, so RFC 4648 also defines a URL-safe alphabet that uses - and _ instead. JSON Web Tokens use the URL-safe form with the padding removed. This tool decodes either alphabet, whichever is selected.
Where you will see Base64
Base64 is used wherever binary data has to travel through a system built for text. Email attachments use it under the MIME standard (RFC 2045), which breaks the output into lines of at most 76 characters. Data URLs embed small files directly in a page, as in data:image/png;base64,… (RFC 2397). HTTP Basic authentication sends username:password as Base64, and certificates and keys in PEM files are Base64 between header lines.
Base64 is not encryption
Anyone can decode Base64 with no key. It changes how data is written, not who can read it. A Base64 string that looks scrambled is not protected, so never use it to hide a password, token or personal data.
| Encoding | Characters | Bits per character | Size compared with the original |
|---|---|---|---|
| Hexadecimal (Base16) | 0–9, A–F | 4 | 200% |
| Base32 | A–Z, 2–7 (standard) | 5 | 160% |
| Base64 | A–Z, a–z, 0–9, +, / (standard) | 6 | about 133% |
| Base64url | A–Z, a–z, 0–9, -, _ | 6 | about 133%, or less without padding |
Frequently asked questions
What is Base64 encoding?
It is a way of writing binary data using 64 safe text characters, defined in RFC 4648. Every three bytes become four characters, so the text is about one third longer than the original data.
Is Base64 encryption?
No. It is a reversible format that needs no key, so it offers no protection at all. Use real encryption if the data must stay secret.
What is the difference between Base64 and Base64url?
Base64url swaps + and / for - and _ so the text is safe in web addresses and file names, and it often leaves off the “=” padding. JSON Web Tokens use it. This tool can produce and read both.
Why does Base64 end in one or two equals signs?
Padding makes the length a multiple of four characters so a decoder knows where the data ends. One “=” means the last block held two bytes, and “==” means it held one. Many systems omit padding, and this tool decodes input with or without it.
Why do I get an invalid character error?
Base64 allows only letters, digits, + and / (or - and _), with = at the end. Anything else, such as a stray quote or a punctuation mark copied from an email, is reported with its position so you can remove it. Spaces and line breaks are ignored.
Why does decoded Base64 sometimes look like random symbols?
The original data was probably not text, for example an image, a compressed file or an encrypted value. The tool then shows the bytes as hexadecimal, and you can download them as a file.
Sources and further reading
- RFC 4648: The Base16, Base32, and Base64 Data Encodings (opens in a new tab) – the standard and URL-safe alphabets, padding rules and test vectors
- RFC 2045: MIME Part One (Format of Internet Message Bodies) (opens in a new tab) – Base64 in email, with lines of at most 76 characters
- RFC 2397: The “data” URL scheme (opens in a new tab) – embedding Base64 data in a URL
- MDN: Base64 (opens in a new tab) – overview and browser APIs