Base64 Encoder/Decoder
Encode and decode text to/from Base64 format
Last updated
How to Use This Tool
Paste text to encode to Base64, or paste Base64 to decode back to readable text, then copy the result.
When Should You Use This Tool?
Use this when you need to safely move small text data through systems that donβt like special characters (not for security).
See also: Unit Converter, Coin Flip .
What does a Base64 encoder and decoder do?
A Base64 encoder turns data into a string built from 64 plain ASCII characters (A to Z, a to z, 0 to 9, plus + and /), so it can pass through systems that only handle text. A decoder reverses the process. This tool encodes any text you type or paste into Base64 or URL-safe Base64URL, and decodes either form back into readable text, all inside your browser.
You will meet Base64 in HTTP Basic Authentication headers, JSON Web Tokens (JWTs), data URLs, email attachments, Kubernetes secrets and many APIs that need to carry binary data inside JSON or XML.
How do I encode or decode Base64 with this tool?
- Pick Encode to Base64 or Decode from Base64 in the Operation menu.
- Paste your text, or the Base64 or Base64URL string you want to read, into the input box.
- When encoding, tick Encode as Base64URL if you need the URL-safe form used in JWTs and URLs.
- Click Process. The result appears below the buttons.
- Click Copy Result to copy the output to your clipboard.
If the input cannot be decoded, the tool shows a message below the buttons explaining why, and clears the previous result so you cannot copy stale output by mistake. Nothing you enter is sent to a server.
How does Base64 encoding work?
Base64 reads the input three bytes (24 bits) at a time, splits those bits into four groups of 6 bits, and maps each 6 bit value (0 to 63) to one character of the alphabet. The classic example is the word "Man":
Text: M a n
Bytes: 77 97 110
Binary: 01001101 01100001 01101110
6-bit: 010011 010110 000101 101110
Index: 19 22 5 46
Base64: T W F u => TWFu
When the input length is not a multiple of three, the encoder adds one or two = padding characters so the output length is always a multiple of four:
| Input text | Bytes | Base64 output |
|---|---|---|
| Man | 3 | TWFu |
| Ma | 2 | TWE= |
| M | 1 | TQ== |
| hello | 5 | aGVsbG8= |
| user:pass | 9 | dXNlcjpwYXNz |
With Encode as Base64URL ticked, the tool writes - instead of +, _ instead of /, and leaves out the padding, so Ma becomes TWE and π becomes 8J-RjQ.
Why is Base64 output about 33% larger than the input?
Base64 output is about 33% larger because every 3 bytes of input become 4 characters of output, a ratio of 4 to 3. The exact length for n input bytes is 4 × ceil(n / 3) characters, so a 30 KB file becomes about 40 KB of Base64 text, and some encoders add line breaks on top of that. This overhead is the reason large images embedded as data URLs often make a page heavier, even though they save an HTTP request.
Is Base64 encryption?
No. Base64 is an encoding, not encryption, and it provides no security. There is no key, so anyone who sees a Base64 string can decode it instantly, including with this page. Take a typical HTTP header:
Authorization: Basic dXNlcjpwYXNz
Decoded: user:pass
That is why Basic Authentication is only safe over HTTPS, and why a Base64 value in a config file or a JWT payload should never be treated as secret. If you need confidentiality, use real encryption such as AES. If you are storing passwords, use a password hashing function such as bcrypt or Argon2.
Does this tool handle Unicode, accents and emoji?
Yes. The browser's built-in btoa() function only accepts characters in the Latin-1 range and throws an error on anything else, so this tool converts your text to UTF-8 bytes first and then encodes those bytes. Decoding reverses both steps, so accented letters, non-Latin scripts and emoji survive a round trip:
cafΓ© => Y2Fmw6k=
π => 8J+RjQ==
Because the tool works on UTF-8, its output matches what you get from the base64 command on Linux and macOS, Buffer.from(text).toString('base64') in Node.js, and base64.b64encode(text.encode('utf-8')) in Python.
Why does Base64 decoding fail?
Before decoding, the tool removes spaces and line breaks, converts the Base64URL characters - and _ to + and /, and adds any missing = padding. So standard Base64, Base64URL and unpadded strings all decode without editing. When decoding still fails, the cause is normally one of these:
| Problem | What it looks like | Fix |
|---|---|---|
| Data URL prefix | data:image/png;base64,iVBOR... | Remove everything up to and including the comma |
| Binary content | An image, PDF or ZIP file encoded as Base64 | The tool says the data looks binary and shows the byte count; use a file decoder, as this tool only outputs text |
| Truncated string | Part of the string is missing, often from a partial copy | Copy the whole string again; a length that is 1 more than a multiple of 4 can never be valid |
| Stray characters | Quotes, backslashes or \n copied from source code | Keep only A to Z, a to z, 0 to 9, +, /, -, _ and = |
How do I read a JWT payload with this decoder?
A JWT has three Base64URL parts separated by dots: header, payload and signature. Copy the middle part, paste it in as it is, and decode it. The tool converts the URL-safe characters and adds the missing padding for you:
Input: eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ
Output: {"sub":"1234567890","name":"John Doe","iat":1516239022}
The signature part is raw binary, so decoding it usually shows the binary data message instead of text. Decoding only shows you the claims. It does not verify the signature, so it tells you nothing about whether the token is genuine.