Skip to content
EverythingTool logo

Developer guides

Base64 Encoding Explained: Examples, UTF-8, Base64URL

Updated 25 September 2026 · 4 min read

Base64 turns any bytes — an image, a PDF, text in any language — into plain letters and digits that survive email, JSON, URLs and HTML. It's everywhere: data URLs, email attachments, API keys and the parts of a JWT.

How it works

Base64 takes 3 bytes (24 bits) at a time and splits them into four 6-bit groups. Each 6-bit value (0–63) maps to one of 64 characters: A–Z, a–z, 0–9, + and /.

TextBase64
Hi!SGkh
NamasteTmFtYXN0ZQ==
नमस्ते (UTF-8)4KSo4KSu4KS44KWN4KSk4KWH

“Hi!” is exactly 3 bytes, so it becomes 4 characters with no padding. “Namaste” is 7 bytes, so it's padded with ==.

Encode or decode Base64Encode text to Base64 or decode Base64 to text, with UTF-8 and URL-safe support.

Indian languages and emoji: use UTF-8

नमस्ते is 6 characters but 18 bytes in UTF-8. JavaScript's btoa() only handles single-byte characters and throws an error on Hindi or emoji — encode to UTF-8 first (new TextEncoder().encode(text)). The Base64 tool does this for you.

Base64URL

Standard Base64 uses +, / and =, which have special meanings in URLs. Base64URL swaps them for - and _ and usually drops the padding. JWTs use it — see how to decode a JWT.

When to use it (and when not to)

  • ✅ Embedding small images or fonts in CSS/HTML, sending files inside JSON, basic-auth headers.
  • ❌ Hiding passwords or secrets — anyone can decode it.
  • ❌ Large files — Base64 makes data about 33% bigger (4 characters for every 3 bytes).

Frequently asked questions

Is Base64 encryption?

No. Base64 is an encoding anyone can reverse instantly. It makes binary data safe to send as text; it does not hide it.

Why does Base64 end with = or ==?

Base64 works in groups of 3 bytes. When the input isn't a multiple of 3, one or two = characters pad the output to a multiple of 4 characters.

Open the Base64 Encoder / DecoderEncode text to Base64 or decode Base64 to text, with UTF-8 and URL-safe support.
Share this guide WhatsApp X Facebook

Official websites, opening in a new tab. EverythingTool isn't affiliated with them.