Advertisement

Base64 Encoder

Encode text or hex bytes to Base64, standard or URL-safe, with or without padding and line breaks. UTF-8 aware and runs entirely in your browser.

Base64 rewrites any bytes using 64 safe ASCII characters, so binary data and non-English text survive places that only accept plain text: HTTP headers, JSON, email, data URIs and config files. This encoder turns your text into UTF-8 bytes first — so accents, Korean and emoji work — or takes raw hex bytes, then encodes them exactly as RFC 4648 describes.

How to use this tool

  1. Type or paste the text (or hex bytes, after switching Input is).
  2. Choose the standard alphabet, or URL-safe for URLs, file names and JWTs.
  3. Keep "=" padding unless the receiving system wants it removed.
  4. Add line breaks only for email bodies (76) or PEM files (64).
  5. Copy the Base64 output.

Formula

output length = 4 × ⌈n ÷ 3⌉ characters (with padding)

Every 3 input bytes (24 bits) become 4 characters of 6 bits each. When n is not a multiple of 3, the last group is completed with "=": one "=" when 2 bytes are left over, two when 1 byte is. Without padding the length is ⌈4n ÷ 3⌉.

Example

HTTP Basic credentials Aladdin:open sesame are 19 bytes. Since 19 = 6 × 3 + 1, the output has 7 groups — 28 characters ending in "==": QWxhZGRpbjpvcGVuIHNlc2FtZQ==, the same string RFC 7617 uses in its example Authorization header.

Frequently asked questions

Is Base64 encryption?

No. It is a reversible encoding with no key — anyone can decode it in a second. Never use it to hide passwords or personal data.

What is URL-safe Base64?

RFC 4648 section 5 swaps + and / for - and _, which have no special meaning in URLs or file names. JSON Web Tokens use this alphabet with the padding removed.

Why does another tool give a different result?

Usually the text encoding: this tool uses UTF-8, while some older tools use UTF-16 or Latin-1, which changes the bytes of any non-ASCII character. Line breaks and padding settings also change the output.

How much bigger does Base64 make data?

About 33%: 4 characters for every 3 bytes, plus line breaks if you add them.

Sources

Last updated: 2026-10-30

Advertisement