Base64 appears in JWTs, email attachments, data URIs, and Basic Auth headers. A clear explanation of what it does, why it exists, and how to encode and decode Base64 free in your browser.
If you have ever seen a string like SGVsbG8gV29ybGQh in a web request or email header, you have encountered Base64 encoding. It is one of the most ubiquitous encoding schemes in computing — used in email, JWTs, data URIs, Basic Auth headers, and dozens of other contexts. Here is what it does and why it exists.
Base64 is an encoding scheme that converts binary data (or any bytes) into a string of 64 printable ASCII characters: A–Z, a–z, 0–9, and two additional characters (usually + and /, or - and _in the URL-safe variant). The output uses = padding at the end if needed.
It is called Base64 because the encoded string uses 64 possible characters at each position, compared to binary's 2 (0 and 1) or hexadecimal's 16 (0–9, A–F).
Important: Base64 is not encryption. It is a reversible encoding — anyone can decode it trivially. It is used for compatibility and transport, not for security.
Many protocols and systems were designed to handle only printable ASCII text — 7-bit characters in the range 32–126. Binary data (images, files, arbitrary bytes) contains values outside this range. When binary data passes through a text-only channel, those bytes can be corrupted or stripped. Base64 solves this by converting any binary data into safe printable text characters.
The trade-off: Base64-encoded data is approximately 33% larger than the original binary (every 3 bytes become 4 characters).
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA..."username:password in Base64 for the Authorization header. (Again, not encryption — always use HTTPS alongside this.)| Variant | Characters 62 & 63 | Padding | Used in |
|---|---|---|---|
| Standard Base64 | + and / | = padding | Email (MIME), general encoding |
| Base64URL | - and _ | Padding optional / omitted | JWTs, URL-safe data URIs, web tokens |
Standard Base64 uses + and /, which have special meanings in URLs and must be percent-encoded. Base64URL replaces them with URL-safe characters. When dealing with JWTs or URL-embedded data, always use the URL-safe variant.
Base64 is a foundational encoding scheme that appears constantly in web development, security tokens, email, and APIs. The ToolsGravity Base64 Encoder / Decoder handles both text and file encoding/decoding in your browser. Remember: Base64 is encoding, not encryption — it provides no security by itself, only data format compatibility. For secure hashing, see the Hash Generator instead.