How to use the Base64 Encode / Decode
- Choose Encode to turn text into Base64, or Decode to turn Base64 back into text.
- Type or paste into the left box — the result updates instantly. Pasting Base64 in Encode mode offers to switch to Decode.
- Tick URL-safe for tokens and URLs (
-and_instead of+and/, no padding). - To encode a file, drop it on the file area; use Copy as data URI to embed it in HTML or CSS.
- If decoded data is binary (an image, a PDF…), you get a preview and a Download file button.
What is Base64?
Base64 is an encoding that represents binary data using only 64 printable ASCII characters: A–Z, a–z, 0–9, + and /, with = as padding. It exists so that arbitrary bytes — images, keys, compressed data — can travel through systems built for text, such as email (MIME), JSON payloads, HTML attributes, HTTP headers and environment variables. Base64 is not encryption: anyone can decode it, so never use it to hide passwords or secrets.
How Base64 encoding works
The encoder takes the input three bytes (24 bits) at a time and splits them into four groups of 6 bits. Each 6-bit value (0–63) maps to one character of the alphabet. For example, the text Man is the bytes 4D 61 6E, which become the 6-bit values 19, 22, 5, 46 → TWFu. When the input length isn't a multiple of three, the output is padded with one or two = signs. As a result, Base64 output is always about 33% larger than the original (4 characters for every 3 bytes).
UTF-8 and the “btoa” problem
Base64 encodes bytes, not characters, so text must first be converted to bytes. This tool always uses UTF-8, the encoding of the web. That matters: JavaScript's built-in btoa("é") produces 6Q== (Latin-1), while UTF-8 gives w6k=, and btoa("👋") throws an error. If a decoded string shows garbled characters like é, the original was probably encoded with a different character set.
Standard Base64 vs. Base64URL
| Standard (RFC 4648 §4) | URL-safe (RFC 4648 §5) | |
|---|---|---|
| Characters 62 and 63 | + and / | - and _ |
| Padding | = required | Usually omitted |
| Used in | MIME email, data URIs, PEM keys, Basic Auth | JWTs, URL parameters, file names |
The decoder accepts both variants, with or without padding and with line breaks, so you can paste values from any source — including full data:image/png;base64,… URIs.
Common uses
- Data URIs — inline small icons in CSS or HTML (see also the Image to Base64 tool).
- HTTP Basic Auth — the header is
Basic+ Base64 ofuser:password. - JWTs — header and payload are Base64URL-encoded JSON; inspect them with the JWT Decoder.
- Kubernetes secrets — values in a Secret manifest are Base64-encoded.
Tools that pair well with the Base64 Encode / Decode
- URL Encode / Decode — Percent-encode text for safe use in URLs, decode encoded strings back to readable text, and break any URL down into its parts and query parameters.
- HTML Entity Encoder — Escape < > & " so text is safe to show in HTML, convert accents and symbols to named or numeric entities, or decode entity-filled HTML back to plain text.
- UUID Generator — Create cryptographically random UUIDs (v4) or sortable, timestamp-based UUIDs (v7) in bulk, then copy or download them.
- Unix Timestamp Converter — See the current Unix time live, convert any epoch timestamp (seconds, milliseconds, micro- or nanoseconds) to a date in any time zone, and turn dates back into timestamps.
Frequently asked questions
Is Base64 encryption?
Why does my decoded text look garbled?
Why is Base64 output longer than the input?
What does the = at the end mean?
= means the last group contained 2 bytes, two == means it contained 1 byte. URL-safe Base64 often omits padding; this decoder works either way.