Base64 Encoding: Complete Guide

Last updated: April 2026 · 4 min read

Base64 is an encoding scheme that converts binary data into a safe ASCII string. It's one of the most common encodings in web development, used everywhere from JWT tokens to email attachments to data URLs.

Why is Base64 Used?

Binary data (images, files, binary protocols) can't always be safely transmitted as text. Base64 converts binary bytes into a set of 64 printable ASCII characters — making it safe for JSON payloads, HTTP headers, HTML data attributes, and email bodies.

Common Use Cases

Base64 vs Base64url

Standard Base64 uses + and /, which are unsafe in URLs. Base64url replaces them with - and _. JWT tokens use Base64url.

How to Decode a JWT Token

A JWT has three parts separated by .: header.payload.signature. The first two parts are Base64url encoded JSON. To inspect a JWT:

  1. Split by . and take the second part (payload)
  2. Decode it as Base64
  3. Parse the resulting JSON to see claims (user ID, expiry, etc.)

Try Our Free Base64 Tool

Our Base64 encoder/decoder handles text and supports both standard Base64 and URL-safe Base64. All processing happens locally in your browser.

Encode / Decode Now →

privacy

Everything runs in your browser.

Format JSON, decode JWT, count words, generate hashes, and convert text without uploading your input.

workflow

Bookmark once, reuse daily.

A compact toolbox for recurring developer, writing, SEO, and AI-content checks.

rootnest

Part of the RootNest product stack.

Use it with OnePost, 周报侠, 内容搭子Pro, and other small focused tools.