Base64 Encoder and Decoder

Encode text to Base64 or decode it back with full UTF-8 support. Accepts URL-safe Base64, JWT segments and line-wrapped MIME blocks, and warns when the data is a binary file.

The output will appear here.
Advertisement Kelivo — a word game by icyabmod, on Google Play and the App Store

How Base64 Encoder and Decoder works

Encode text to Base64 or decode it back with full UTF-8 support. Accepts URL-safe Base64, JWT segments and line-wrapped MIME blocks, and warns when the data is a binary file.

Input Text / Base64
Output Encoded or decoded text
Works done 5,034

How to use it

Use this tool to Base64 decode a string back into readable text, or to encode plain text as Base64. It handles UTF-8 correctly, so accents, emoji and non-Latin scripts survive the round trip. The decoder also accepts URL-safe Base64, as used in JSON Web Tokens, and line-wrapped MIME blocks copied from raw email. Auto mode picks the direction, and it all runs in your browser.

How to Base64 decode or encode text

  1. Paste the text you want to encode, or the Base64 string you want to decode, into the input box.
  2. Choose a mode: "Auto-detect", "Encode" or "Decode".
  3. Click "Run tool" or press Ctrl + Enter (Cmd + Enter on macOS).
  4. Check the output; if you see an error, look it up in the troubleshooting list below.
  5. Copy the result or download it as a text file.

Auto, Encode or Decode: which mode to pick

Auto mode only decodes input that really looks like Base64: no spaces, a length that is a multiple of 4, only characters from the standard alphabet, and a result that is readable UTF-8 text. Anything else is encoded. That keeps ordinary words such as "hello" from being decoded into garbage.

Force the mode in two situations. Short strings can be valid by accident: QUFB might be a product code, yet it decodes to AAA. And URL-safe strings, such as JWT segments with - or _ or with the padding stripped, fail the auto check and would be encoded a second time. Pick "Decode" for those and they are handled correctly.

Why the output is longer, and what the = signs mean

Base64 maps every 3 bytes of input to 4 characters drawn from a 64-character alphabet, so encoded data is roughly a third larger than the original. When the byte count is not divisible by 3, the last group is padded with =: one leftover byte gives ==, two leftover bytes give a single =. Characters outside ASCII take several bytes in UTF-8, which is why a single emoji produces eight characters of output.

TextUTF-8 bytesBase64
M1TQ==
Ma2TWE=
Man3TWFu
hello5aGVsbG8=
€34oKs
👍48J+RjQ==

Missing padding is fine when decoding, because the tool recalculates it from the length. Extra padding, as in SGVsbG8==, is rejected as an invalid length.

Recognizing what a Base64 string contains

The first few characters of a Base64 string reveal the first bytes of the data, and many file types start with a fixed signature. Once you know the common prefixes, you can tell at a glance whether a decode will give you text or a binary file:

Starts withDecoded data begins withUsually means
eyJ{"A JSON object, for example a JWT header or payload
PD94bWw<?xmlAn XML document
PHN2Zy<svgAn inline SVG image (text, so it decodes)
/9j/JPEG markerA JPEG photo (binary)
iVBORw0KGgoPNG signatureA PNG image (binary)
JVBERi0%PDF-A PDF document (binary)
UEsDBZIP headerA ZIP archive, which also covers DOCX and XLSX files

URL-safe Base64, MIME and JSON Web Tokens

The standard alphabet uses + and /, both of which mean something in URLs, so the URL-safe variant swaps them for - and _ and usually drops the padding. The same bytes appear as PDw/Pz8+Pg== in standard form and PDw_Pz8-Pg in URL-safe form, and the decoder turns both into <<???>>. Encoding always produces the standard alphabet with padding; to get a URL-safe value, replace the two characters and trim the trailing =.

MIME email bodies wrap Base64 at 76 characters per line. Line breaks and spaces are ignored during decoding, so you can paste the block straight from the raw message source.

A JWT is three Base64url segments joined by dots. The dots are not part of the alphabet, so paste the header or the payload on its own. eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9 decodes to {"alg":"HS256","typ":"JWT"}, and a long payload is easier to read after a pass through the JSON formatter. Being able to read a token says nothing about whether it is genuine; only signature verification proves it has not been tampered with.

Troubleshooting decode errors

  • Invalid Base64: only A-Z, a-z, 0-9, +, /, - , _ and = padding are allowed. Something outside the alphabet slipped in. Typical culprits are a data:image/png;base64, prefix, the dots of a full JWT, or quotes copied along with a JSON value.
  • Invalid Base64: the length is not valid. The string was truncated or has surplus = signs. Copy it again from the source.
  • The decoded data is not UTF-8 text (it may be a binary file). The bytes are an image, archive or other binary file, or text stored in a legacy encoding such as Windows-1252. The tool warns instead of printing mojibake.

Base64 is encoding, not encryption

Anyone can reverse Base64 in seconds, because there is no key involved. An HTTP header such as Authorization: Basic dXNlcjpwYXNz simply carries user:pass in readable form, which is why Basic authentication is only acceptable over HTTPS. Use Base64 to move binary data through text-only channels such as email, JSON fields or HTTP headers, never to hide secrets. The background is covered in what is Base64.

Encoding and decoding happen in JavaScript inside your browser tab; your input is not sent to the server, and the page only bumps an anonymous usage counter. For percent-encoded strings like %20, use the URL encoder and decoder, or browse the full set of developer tools.

Advertisement Clicker Alchemist — a mobile game by icyabmod, on Google Play and the App Store

Frequently asked questions

Paste the string into the input box, leave the mode on Auto-detect or switch it to Decode, and run the tool. The readable text appears in the output panel, ready to copy. If the string came from a URL, a JWT or an API key, choose Decode explicitly, because URL-safe strings often fail the automatic check. If you get a warning that the data is not text, the string most likely contains an image or another binary file.

Garbled characters usually mean the original text was not UTF-8 when it was encoded, for example a legacy Windows code page. This tool decodes strictly as UTF-8, so instead of showing broken characters it reports that the data is not UTF-8 text. The same warning appears for compressed or encrypted payloads that were Base64-encoded afterwards. Fix it at the source by encoding the text as UTF-8, or decompress or decrypt it first with the right tool.

Yes, one segment at a time. A token has three parts separated by dots: header, payload and signature. Copy the first or second part, select Decode mode and run the tool to see the JSON inside. The signature segment is binary and will trigger a warning. Remember that decoding only lets you read the claims; it does not verify the signature, so never trust a token just because its payload looks right.

No. Base64 is a reversible encoding with no key, so anyone who sees the string can read the original value. Passwords should be stored with a slow, salted hashing algorithm designed for that purpose, such as bcrypt, scrypt or Argon2, and transmitted only over HTTPS. Base64 has a legitimate role in carrying binary data through text formats, but it adds no confidentiality at all.

Yes, by about 33 percent, because every 3 bytes become 4 characters. Line breaks added by MIME wrapping add a little more. That overhead is why embedding large images as Base64 data URIs in HTML or CSS usually slows a page down: the data cannot be cached separately and inflates the document. For small icons the saved HTTP request can be worth it; for photos it rarely is.