Skip to content

What is Base64?

Learn Base64 encoding—why APIs use it, how it differs from encryption, and how to encode or decode strings locally in your browser.

Base64 turns arbitrary bytes into an ASCII-safe string using 64 characters. It shows up in email attachments, data URLs, HTTP basic auth, and JWT segments. The important mental model: Base64 is encoding, not encryption. Anyone who sees the text can decode it back to the original bytes.

Why systems use Base64

Some protocols prefer text. Binary blobs break in places that expect printable characters. Base64 expands data by about one third, which is usually acceptable for tokens and small binaries. URL-safe variants replace + and / so tokens survive in query strings.

Base64 vs other representations

  • Hex doubles size but is easier to skim for byte dumps and hashes.
  • Base64 is denser and dominates JWT and MIME use cases.
  • Hashing (SHA-256, etc.) is one-way; Base64 is reversible.

See Base64 vs Hex Encoding for a side-by-side table.

Practical tips

  1. Decode before you try to pretty-print nested JSON.
  2. Watch for missing padding (=) when systems strip it.
  3. Use the URL-safe alphabet when a token lives in a URL.
  4. Never assume Base64 hides secrets—treat decoded output as sensitive if the source was.

Practice on ToolHub

Use Base64 Encode/Decode to round-trip strings locally. When a JWT appears as three Base64url segments, continue with JWT Decoder. For digest workflows that often sit beside encoding, try Hash Generator.

Related learning

JSON payloads are frequently Base64-wrapped in transit—read What is JSON? next. For token-shaped data, continue with What is JWT?.

Try related tools

Keep exploring