What is Base64?
Base64 is an encoding scheme that converts binary data — or any text — into a string made up only of letters, numbers, and a few symbols. The result is safe to transmit through systems that might otherwise misinterpret special characters, like email, URLs, or HTML attributes.
You’ll encounter Base64 regularly when dealing with email attachments, embedding images directly into web pages, passing data in URLs, or reading authentication tokens. It’s not encryption — anyone can decode it — it’s purely a way to represent data in a universally safe text format.
What Does This Tool Do?
This tool encodes plain text or binary data into Base64 format and decodes Base64 strings back to their original form. It works instantly in your browser as you type.
Toggle URL-safe to swap the standard alphabet (+, /, =) for the URL-safe variant (-, _, no padding) — the form used in JWTs, OAuth state parameters, and any token that travels in a URL or filename.
How to Use This Tool
- Choose the mode: Encode to convert text to Base64, or Decode to reverse it.
- Optionally toggle URL-safe if you need the URL-friendly alphabet.
- Type or paste your input into the text area.
- The result appears immediately.
- Click the copy button to grab the output. The decoder accepts both standard and URL-safe input automatically.
Common Use Cases
- Basic authentication: HTTP Basic Auth credentials are sent as Base64-encoded
username:password. - Embedding images: Inline images in HTML or CSS use Base64-encoded data URIs.
- Inspecting tokens: Many API tokens and JWTs contain Base64-encoded segments.
- Data transfer: Safely pass binary or special-character data through systems that only accept plain text.
A Worked Example
Encoding the text Hello! produces SGVsbG8h. Here’s what happens under the hood: the six characters become six bytes, the bytes are split into groups of three, and each group of three bytes (24 bits) is re-split into four groups of 6 bits. Each 6-bit value maps to one character in the Base64 alphabet. Because 3 bytes always become 4 characters, Base64 output is roughly 33% larger than the original data.
Decoding reverses the process exactly — which is why Base64 is lossless and works for any data, not just text.
Standard vs URL-Safe Alphabet
| Standard Base64 | URL-safe Base64 | |
|---|---|---|
| Character 62 | + | - |
| Character 63 | / | _ |
| Padding | = | usually omitted |
| Defined in | RFC 4648 §4 | RFC 4648 §5 |
| Typical use | Email (MIME), data URIs, HTTP Basic Auth | JWTs, OAuth tokens, URL parameters, filenames |
If you paste a token and see - or _ characters, it’s URL-safe Base64 — this tool decodes both variants automatically.
Quick Reference: Common Base64 Strings
| Encoded | Decoded |
|---|---|
dXNlcm5hbWU6cGFzc3dvcmQ= | username:password (Basic Auth format) |
eyJhbGciOiJIUzI1NiJ9 | {"alg":"HS256"} (a JWT header) |
data:image/png;base64,… | prefix of an inline image data URI |
Spotting eyJ at the start of a string is a classic tell: it’s the Base64 encoding of {", which means the payload is JSON — almost always a JWT.
Frequently Asked Questions
Is Base64 the same as encryption?
No. Base64 is encoding, not encryption. Anyone can decode a Base64 string without a key. Never use it to protect sensitive information.
Why does Base64 output end with = signs?
Base64 works in groups of 3 bytes. If the input isn’t a multiple of 3 bytes, padding characters (=) are added to complete the group. This is normal.
What is URL-safe Base64?
Standard Base64 uses + and / in its alphabet, plus = for padding — characters that need escaping in URLs and aren’t valid in filenames. URL-safe Base64 swaps + for - and / for _, and drops the = padding entirely. It’s the form used by JWTs, OAuth, and most modern tokens.
Is my data safe?
Yes — all encoding and decoding happens locally in your browser. Nothing is sent to a server.
Why do I get an error when decoding?
The most common causes are: the string contains characters outside the Base64 alphabet (often invisible whitespace or line breaks from copy-paste), the string was truncated so its length is invalid, or the text simply isn’t Base64. Try trimming whitespace first — that fixes most cases.
How much larger does Base64 make my data?
About 33%. Every 3 bytes of input become 4 characters of output, plus up to 2 padding characters. That’s why embedding large images as Base64 data URIs increases page weight — it’s convenient, but not free.
Does Base64 work with emoji and accented characters?
Yes. Text is first converted to UTF-8 bytes and then encoded, so any character — emoji, Chinese, Arabic, accented letters — round-trips correctly through encode and decode.