Base64 Encoder and Decoder

Paste text to turn it into Base64, or paste a Base64 string to read what is inside. Accented letters, emoji and other Unicode text are handled correctly, and a URL-safe option swaps the two characters that break web addresses. Useful when you are reading an API payload, building a data URL or checking what a token really contains.

What you enter

What you get

How it works

  1. Choose Encode to turn plain text into Base64, or Decode to turn Base64 back into text.
  2. Paste your input. The result appears straight away, and a clear message tells you if the Base64 is not valid.
  3. Tick URL-safe if the result goes into a web address, a file name or a token. It uses - and _ instead of + and / and drops the = padding.
  4. Copy the result or download it as a text file.

Why Base64 exists

Many older systems were built to carry plain text only. Email, for one, could not safely carry raw bytes, so attachments were written out as Base64 text. The same idea lives on in web work: a small image can be embedded in a stylesheet as a data URL, a JSON field can carry a file, and a login token can hold structured data in a form that survives being put in a header.

The price is size. Four characters stand for three bytes, so encoded data is roughly 33 percent larger than the original. That is fine for a short token or a tiny icon, and wasteful for a photo, which is better served as an ordinary file with caching.

Common mistakes

The most common mistake is treating Base64 as security. It has no key and no secret, so a Base64 string is exactly as private as the text it came from. If something must stay secret, it needs real encryption or, better, should never be placed in a client at all.

The second is mixing alphabets. A string taken from a web address may use - and _, while a library that expects the standard alphabet will reject it. This tool reads both, so paste the string as you found it and switch the URL-safe box only to control what you produce.

Tips

Frequently asked questions

What is Base64?

Base64 is a way to write any data using only 64 plain characters: A to Z, a to z, 0 to 9, plus and slash. It lets binary data travel through systems that only handle text, such as email, JSON files and web addresses.

How does Base64 encoding work?

The text is first turned into bytes (UTF-8). The bytes are read in groups of three, which is 24 bits, and each group is split into four 6-bit numbers. Each number from 0 to 63 picks one character from the alphabet. If the last group is short, = signs pad the end. For example, the text Man is the bytes 77, 97, 110 and encodes to TWFu.

What does URL-safe Base64 change?

Standard Base64 uses + and /, which have special meanings inside web addresses and file paths. The URL-safe form replaces + with - and / with _, and usually removes the = padding so the string can sit in a link or a token without escaping.

Why does decoding sometimes fail?

Base64 can only contain letters, digits, + / (or - _) and = at the end. A stray character, a string whose length leaves exactly one character over, or bytes that are not valid UTF-8 text will all be reported as errors instead of giving you garbled output.

Is my text sent to a server?

No. The conversion happens in your browser, so tokens, payloads and anything else you paste stay on your device.

Related: JSON formatter, Hex converter, Binary converter.

Start for free or see all free tools. We.Inc is free to start, with no card needed. AI building is on paid plans from $20 a month.

More in Free Tools

We.Inc is an AI-powered website builder you can resell under your own brand. Launch a branded client dashboard, bill on Stripe Connect, and deliver AI-generated websites in minutes. White-label plans start at $99 a month for 25 client sites, with a 7-day free trial and no per-site fees.

Product

Who It's For

Features

Resources

Company

View Sitemap