Skip to content

Base64 Encoder & Decoder

Encode text to Base64 or decode Base64 back to readable text, with full support for UTF-8, accents and emoji-range characters.

Runs entirely in your browser. Nothing is uploaded.

Step by step

How to use the Base64 Encoder & Decoder

  1. 1

    Choose Encode or Decode.

  2. 2

    Paste your text or Base64 string.

  3. 3

    Optionally enable URL-safe Base64.

  4. 4

    Copy the output or download it as a text file.

What it does well

True UTF-8 handling

Text is converted to UTF-8 bytes before encoding, so any Unicode character round-trips correctly.

Strict validation

Invalid characters, wrong padding and bytes that are not valid UTF-8 are detected and explained.

URL-safe variant

Uses - and _ instead of + and / and omits padding, as used in JWTs and URLs.

Whitespace tolerant

Line breaks in wrapped Base64, such as from email or PEM files, are ignored when decoding.

Who uses it

Developers
Inspect JWT segments, HTTP basic auth headers and data URIs.
Support engineers
Decode encoded values from logs and configuration.
Students
Learn how binary-to-text encoding works.

What Base64 is and is not

Base64 represents binary data using 64 printable characters: A to Z, a to z, 0 to 9, plus + and /. Every 3 bytes become 4 characters, so the encoded output is about 33% larger than the input. It is used to embed binary data in text-only formats such as JSON, email and HTML data URIs.

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

Why Unicode needs special care

The browser's built-in btoa function only accepts characters in the Latin-1 range and throws an error for text like Japanese or Hindi. This tool first encodes text with TextEncoder into UTF-8 bytes and then Base64-encodes those bytes. Decoding reverses the process with a strict UTF-8 decoder, so corrupted input is reported rather than turning into garbled characters.

Frequently asked questions

Is Base64 secure?

No. It is a reversible encoding for transport, not a security measure.

Why does decoding say the result is not valid UTF-8?

The Base64 probably represents binary data such as an image, not text, or it was truncated.

What is URL-safe Base64?

A variant that swaps + and / for - and _ so the value can be used in URLs and filenames without escaping.

Related tools