Base64 Encode / Decode

Convert text to Base64 and back, fully UTF-8 safe — emoji and any language work. Everything runs in your browser — your text never leaves your device.

How to encode or decode Base64

  1. Paste your text (or a Base64 string) into the top box.
  2. Click Encode to convert plain text to Base64, or Decode to turn a Base64 string back into readable text. A green or red message tells you whether it worked.
  3. Click Copy result to grab the output. Leading and trailing spaces around a Base64 string are ignored when decoding.

What is Base64?

Base64 represents any data using just 64 safe characters — A–Z, a–z, 0–9, + and /, with = as padding. It exists so binary data or special characters can pass through systems built for plain ASCII text: email bodies, JSON payloads, data URIs, HTTP headers and configuration files.

This tool is UTF-8 safe. The browser's raw btoa() function fails on any character above code point 255, but this page first converts your text to UTF-8 bytes, so emoji, accented letters, Korean, Japanese, Chinese and every other Unicode character encode and decode correctly.

How it works, with real examples

Base64 reads the data three bytes (24 bits) at a time and splits those bits into four groups of six, each mapped to one of the 64 characters. Three bytes in, four characters out. When the input is not a multiple of three bytes, = signs pad the end.

  • Hello encodes to SGVsbG8= (5 bytes, one pad).
  • Hello, World! encodes to SGVsbG8sIFdvcmxkIQ== (13 bytes, two pads).
  • user:pass encodes to dXNlcjpwYXNz — the format of an HTTP Basic authentication header after the word “Basic”.
  • A single accented letter, é, is two bytes in UTF-8 and encodes to w6k=.

Because every 3 bytes become 4 characters, Base64 output is always about 33% larger than the original. That overhead is the reason it is a poor choice for storing large files and the reason embedded images inflate a web page.

Base64 is not encryption

A common mistake is treating Base64 like a way to hide data. It is only an encoding — a reversible re-labelling of bytes with no key. Anyone can decode it in a second (this page proves it). Do not put passwords, API keys or personal data in Base64 and consider them protected; use real encryption or, for passwords, a one-way hash such as the ones produced by the hash generator.

When decoding fails or looks wrong

  • “Not valid Base64” means the input contains characters outside the standard alphabet, or has an impossible length. Typical culprits are stray quotation marks, a copied “data:…base64,” prefix, or a truncated string.
  • URL-safe Base64 replaces + with - and / with _ and often drops the padding. It is used in JWTs and many web APIs. This tool decodes the standard alphabet, so swap those two characters back (- to +, _ to /) before decoding. To inspect a JWT directly, use the JWT decoder.
  • Garbled or “�” characters in the result mean the data is not UTF-8 text. Base64 of an image, PDF or compressed file decodes to raw bytes, and showing those bytes as text is meaningless. Text that was originally saved in another character set, such as Latin-1, shows the same symptom, because this decoder always reads the bytes as UTF-8. For images, use the image to Base64 converter in the other direction.

Where developers use text Base64

Typical uses include Basic authentication headers, embedding small payloads in JSON or XML, storing multi-line values such as certificates in environment variables, building data: URIs, and the three dot-separated segments of a JSON Web Token. Encoding text here also lets you quickly check what an API or log line actually contains, since encoded strings that begin with eyJ are usually Base64 of a JSON object starting with {".

Is it private and safe?

Yes. Encoding and decoding happen inside your browser on your own device, using built-in browser functions. Your text is never uploaded or logged — important when what you are decoding is a token or credential from a real system.

Related guides: How to convert an image to Base64, Base64 image size overhead, how to decode a Base64 image and SHA-256 hashing explained for the difference between encoding and hashing.

Frequently asked questions

What is Base64?

Base64 is an encoding that turns any data into a string of 64 safe characters (A-Z, a-z, 0-9, + and /), with = used as padding. It lets binary data or special-character text travel safely through systems that handle only plain ASCII, such as email, JSON and HTTP headers.

Does Base64 encrypt my text?

No. Base64 is an encoding, not encryption, and has no key. Anyone can decode it instantly, so never use it to hide passwords or secrets.

Why is the Base64 output longer than my original text?

Every 3 bytes of input become 4 characters of output, so the result is about 33% larger, plus up to two padding characters. Text with non-English characters starts out with more bytes, because each such character takes 2 to 4 bytes in UTF-8.

What are the = signs at the end?

They are padding. Base64 works in groups of 3 bytes, so if the data does not divide evenly, one or two equals signs fill out the last group of four characters. For example, Hello ends with one equals sign and Hello, World! ends with two.

Why do I get 'Not valid Base64' when decoding?

The input probably contains characters outside the standard alphabet, a stray quote or prefix such as data:text/plain;base64, or a damaged length. URL-safe Base64 that uses - and _ instead of + and / must be converted back to the standard characters first.

Why does the decoded result contain strange symbols?

The data is probably not UTF-8 text. Base64 is often used for images, documents and other binary files, which decode to raw bytes that cannot be displayed as readable text. Text in another character set, such as Latin-1, can also show up garbled.

Is my text uploaded?

No. Encoding and decoding run entirely in your browser, so nothing is sent to a server or stored.

Is it free?

Yes. It is completely free with no sign-up.