How to use it
Paste text and press Encode to get Base64, or paste Base64 and press Decode to get the original text back. Tick URL-safe before encoding if the result goes into a URL, a filename or a JWT. Decoding accepts both the standard and the URL-safe alphabet, with or without = padding, and ignores line breaks and spaces, so you can paste wrapped Base64 from emails or PEM files.
What Base64 is (and is not)
Base64 represents any sequence of bytes using 64 safe characters: A–Z, a–z, 0–9, + and /, with = as padding. Every 3 bytes become 4 characters, so encoded data is about 33% larger than the original. It is used to carry binary or non-ASCII data through systems that only handle plain text: email attachments (MIME), data: URLs, HTTP Basic authentication headers, JSON Web Tokens and API payloads.
Base64 is not encryption. Anyone can decode it instantly. Never use it to hide passwords or secrets.
Worked examples
| Text | Base64 |
|---|---|
hello | aGVsbG8= |
user:pass | dXNlcjpwYXNz (as in an Authorization: Basic header) |
Grüße | R3LDvMOfZQ== |
✓ done | 4pyTIGRvbmU= |
The last two show why UTF-8 matters: the umlaut, the sharp s and the check mark each take two or three bytes in UTF-8, and this tool encodes those bytes correctly.
Why UTF-8 safe matters
The browser's built-in btoa() function only accepts characters in the Latin-1 range. Calling btoa("✓") throws an InvalidCharacterError, and some online tools silently produce wrong output for accented letters. This tool first converts your text to UTF-8 bytes with TextEncoder, then encodes those bytes. Decoding reverses the steps with a strict UTF-8 decoder, so you get an error instead of garbled text when something is off.
Common decoding errors
- "Characters that are not valid Base64": the input contains something outside the Base64 alphabet, such as a quote, a comma, or a
data:image/png;base64,prefix. Remove everything before the actual Base64 data. - "Length is not valid": one character is missing or extra, usually from an incomplete copy. Check the beginning and end of the string.
- "Not valid UTF-8 text": the Base64 decodes fine but the bytes are binary data such as an image, PDF or compressed file, not text. That is expected; this tool decodes to text only.
- Decoding a JWT: a token has three parts separated by dots. Decode the header or payload part on its own, not the whole token.
Frequently asked questions
Is Base64 encryption?
No. Base64 is an encoding, not encryption. Anyone can decode it without a key, so it must never be used to protect passwords or secret data.
What does URL-safe Base64 mean?
URL-safe Base64 replaces + with - and / with _ and usually drops the = padding, so the result can be used in URLs, filenames and JSON Web Tokens without further escaping.
Why do I get an error when decoding?
The most common causes are extra characters such as a data URL prefix or quotes, a string that was cut off when copying, or Base64 that contains binary data such as an image rather than text.
Does this tool support emoji and non-English text?
Yes. Text is converted to UTF-8 bytes before encoding, so accents, non-Latin scripts and emoji encode and decode correctly.
Why is the Base64 output longer than my text?
Base64 turns every 3 bytes into 4 characters, so the output is about one third larger. Characters outside basic ASCII also take 2 to 4 bytes each in UTF-8.
Is my data sent to a server?
No. Encoding and decoding run entirely in your browser.