Base64 Decode and Encode
Paste Base64 to decode it to readable text, or paste text to encode it. Accents, Cyrillic and emoji work in both directions, and the URL-safe variant used in JWTs and URLs is one switch away: "SGVsbG8sIHdvcmxkIQ==" decodes to "Hello, world!".
The preview is shortened. Copy and Download include the whole result.
Your text never leaves your device.
How to use
- Choose Encode to turn text into Base64, or Decode to turn Base64 back into text.
- Paste your input. Turn on URL-safe for Base64url (- and _ instead of + and /, no = padding).
- Copy the result. If the input is not valid Base64, the message says what is wrong and where.
Examples
- Before
- Hello, world!
- After
- SGVsbG8sIHdvcmxkIQ==
- Before
- привет 👍
- After
- 0L/RgNC40LLQtdGCIPCfkY0=
- Before
- привет 👍
- After
- 0L_RgNC40LLQtdGCIPCfkY0
- Before
- SGVsbG8
- After
- Hello
How encoding works
Base64 takes the bytes of your text three at a time (24 bits) and writes them as four characters of 6 bits each. If the last group has only one or two bytes, the output is padded with = or ==: “a” encodes to “YQ==”, “ab” to “YWI=”. So the encoded text is always about a third longer than the original: 3 bytes in, 4 characters out.
Text is converted to bytes as UTF-8 first. That is why “привет 👍”, 8 characters, becomes 24 Base64 characters: each Cyrillic letter takes 2 bytes and the emoji takes 4, 17 bytes in all. Tools that skip the UTF-8 step (such as the browser’s bare btoa function) fail on anything outside Western European letters.
Errors the decoder catches
- Unexpected character: Base64 contains only letters, digits, + / - _ and =. “abc*” fails at position 4. Watch for characters picked up while copying, such as quotes or a trailing period.
- Wrong length: valid Base64 never leaves a single character in the last group of four, so a string of that length was cut off while copying.
- Not text: the data decodes to binary, such as an image, not to UTF-8 text.
Common mistakes
- Treating Base64 as a way to hide data. It is readable by anyone. Encrypt secrets and use Base64 only to transport the result.
- Mixing up standard and URL-safe output. A server expecting standard Base64 may reject - and _. Match what the receiving system expects.
- Encoding text that is already encoded. Encoding twice gives a longer string that decodes to Base64, not to your text. If the output looks like Base64, decode again.
- Using Base64 for large files in web pages. A data: URL is a third larger than the file and cannot be cached separately. Keep it for small icons.
Frequently asked questions
How do I decode Base64?
Select Decode and paste the Base64 string. The decoded text appears immediately. Padding (=) is optional, standard and URL-safe characters are both accepted, and line breaks inside the input are ignored, so Base64 copied from an email source or a PEM file decodes as is.
What is Base64 used for?
Base64 turns any bytes into 64 safe characters (A–Z, a–z, 0–9, + and /) so that binary data can travel through systems built for text. You meet it in email attachments, data: URLs for images, the parts of a JSON Web Token, HTTP Basic authentication headers, and API fields that carry files or keys.
Is Base64 encryption?
No. Base64 is an encoding: anyone can decode it, without a key, in one step. It hides nothing. Never use it to protect passwords or secrets; a Basic auth header or a JWT payload is readable by anyone who sees it.
What is URL-safe Base64 (Base64url)?
Standard Base64 uses + and /, which have special meanings in URLs, and = padding. Base64url (RFC 4648 section 5) replaces + with - and / with _ and usually drops the padding. JWTs, many OAuth parameters and file names use it. Turn on URL-safe to encode in this form; decoding accepts both forms automatically.
Why does decoding say the result is not text?
Base64 can contain any data: images, PDFs, compressed files. If the decoded bytes are not valid UTF-8 text, the tool tells you instead of showing unreadable characters. A string starting with iVBORw0KGgo is a PNG image, for example, and /9j/ is a JPEG.