Base64 decoder — quick reference
The most common task: you have a base64 string and need to see what it says. Paste it in with Decode mode selected (or leave it on Auto) and the decoded text appears immediately. For encoding, switch to Encode, type your text, and copy the output.
Classic example — encoding "Hello":
Input: Hello
Output: SGVsbG8= Decoding back:
Input: SGVsbG8=
Output: Hello
Each group of 3 bytes (24 bits) in the source becomes 4 base64 characters (6 bits each).
"Hello" is 5 bytes, which expands to 8 base64 characters with one = padding character.
Try it with the decoder above — paste SGVsbG8= and click Decode.
More examples to try in the base64 decoder:
SGVsbG8gV29ybGQ=— decodes to Hello WorldeyJhbGciOiJIUzI1NiJ9— decodes to {"alg":"HS256"} (JWT header)dXNlcjpwYXNzd29yZA==— decodes to user:password (HTTP Basic Auth)
How to use the base64 encoder decoder
- Pick a mode: Encode (text → Base64), Decode (Base64 → text), or Auto (detects from input).
- Paste into the left textbox. Processing runs automatically after 200ms.
- Toggle options as needed: URL-safe (
-_instead of+/), No padding (strip trailing=), Wrap 76 (MIME-style line wrapping). - For files, click Upload file (up to 10MB). The output is a full
data:URL ready to paste into HTML or CSS. - Copy with the Copy button or
Ctrl/⌘ + Shift + C.
What is base64 encoding?
Base64 encoding is a method of representing binary data using only 64 printable ASCII characters:
A–Z, a–z, 0–9, +, and /,
with = used for padding. It's defined in
RFC 4648. The
encoded output is about 33% larger than the original because every 3 bytes of input (24 bits)
become 4 characters of output (6 bits per character).
The name "base64" comes from the fact that the encoding uses 64 distinct characters as its alphabet. This contrasts with hexadecimal (base16, which doubles file size) or raw binary. Base64 strikes the best balance between compactness and compatibility with text-only systems.
Base64 is not encryption. It's a fully reversible encoding — anyone with a base64 decoder (including this free online tool) can decode it back to the original in seconds. Use it for transport, not secrecy. If you need actual security, use cryptographic hashing or AES encryption.
URL-safe Base64 vs standard Base64
Standard Base64 uses + and /, which have special meaning in URLs and filenames.
URL-safe Base64 (RFC 4648 §5) replaces them with - and _.
It's used in JWTs, OAuth tokens, and most modern web APIs. Use the URL-safe option whenever the output
needs to survive a URL, filename, or identifier.
Padding (=) is often omitted in URL-safe Base64 because its length information is implicit.
The No padding option strips trailing = characters. This tool re-pads
automatically when decoding, so unpadded input works fine.
Common base64 use cases
Base64 encoding appears throughout modern web development wherever binary data must cross a text-only boundary. Here are the four most common scenarios:
Embedding images and assets as data URLs
HTML and CSS support data: URLs that contain the entire file as base64. A small
icon encoded as data:image/png;base64,iVBORw0KGgo... in a <img>
or CSS background-image eliminates a separate HTTP request. Best for images under
10KB — beyond that, HTTP caching wins.
JWT tokens and OAuth
Every JSON Web Token is three base64url-encoded segments separated by dots:
header.payload.signature. The header and payload are base64-decoded JSON objects.
Using this free JWT decoder you can inspect any JWT — but you
can also decode the individual segments right here in the base64 decoder by pasting each part
separately.
API authentication headers
HTTP Basic Authentication encodes credentials as base64(username:password) and
sends them in an Authorization: Basic ... header. This is encoding, not encryption
— anyone who intercepts the header can decode it. Always use HTTPS with Basic Auth.
Binary data in JSON payloads
JSON only supports text. When an API needs to transfer a file, image, certificate, or any binary blob inside a JSON response, base64 encoding is the standard approach. The receiver runs it through a base64 decoder to recover the original bytes.
When not to use base64:
- Never use base64 for secrecy — it's trivially reversible. Use cryptographic hashing for passwords and data integrity.
- Large files in HTML — beyond ~10KB, external URLs with caching are faster.
- URL parameters — use URL encoding (percent-encoding) instead.
- Binary protocols — if you control both ends, skip base64 and save the 33% overhead.
Common errors and what they mean
"Invalid character in Base64 string"
Your input contains a character outside the Base64 alphabet. The usual suspects: a stray space, a newline
in the middle, a URL-safe string being decoded in standard mode (switch URL-safe on),
or unescaped + characters that became spaces during URL transport.
"Length is not a multiple of 4"
Base64 must be padded to a multiple of 4 characters. This tool re-pads automatically, but if you see the
error elsewhere (e.g., in Python's base64.b64decode), add = until the length
is a multiple of 4, or use urlsafe_b64decode variants that tolerate missing padding.
Garbled decoded output
Usually a character-encoding mismatch. This tool decodes as UTF-8. If your input was originally in Latin-1, Windows-1252, or another encoding, you'll get mojibake. Copy the decoded bytes into a hex viewer or re-encode the original source as UTF-8 before encoding.
UTF-8 vs Latin-1 gotcha
The browser's built-in btoa() and atob() only work on Latin-1 (single-byte)
strings and will throw on characters outside that range — including most emoji, CJK characters, and
accented Latin beyond ISO-8859-1. This tool uses TextEncoder/TextDecoder for
proper UTF-8 support, so strings like "🦊 résumé 日本" encode and decode correctly.
Frequently asked questions
What is a base64 decoder and when do I need one?
A base64 decoder converts base64-encoded text back to its original form — plain text, binary data, images, or any other content that was encoded. You need a base64 decoder when you encounter a base64 string and want to read what it contains: inspecting a JWT token, debugging an API response, extracting an image from a data URL, or reading credentials encoded in an Authorization header. This online base64 decoder handles all of these cases directly in your browser.
Is the base64 encoder and decoder really client-side?
Yes. All encoding, decoding, and file processing happens in JavaScript running in your browser. You can verify this by opening DevTools → Network and watching: no request is sent when you click Encode or upload a file. You can also disconnect from the internet after the page loads and the tool keeps working.
Can I encode a whole file to Base64?
Yes — click Upload file. The output is a full data: URL (including the
detected MIME type), which you can paste directly into <img src="..."> or
url(...) in CSS. File size cap is 10MB to keep the UI responsive; beyond that, browsers
get slow and most real use cases want a proper asset URL anyway.
How do I convert Base64 back into a downloadable file?
Paste the Base64 (or full data URL) into the input, select Decode, and the decoded
bytes will be interpreted as UTF-8 text. To reconstruct a binary file, use a language-native base64
decoder (Python base64.b64decode, Node Buffer.from(s, 'base64')) and write
the bytes to disk. A browser-native "Download decoded file" is on the roadmap.
Does this tool support Base64 URL-safe JWT tokens?
Yes — enable URL-safe and No padding, then decode each of the three dot-separated sections of a JWT. For a dedicated token-parsing experience with algorithm info and claim pretty-printing, see the upcoming JWT Decoder.
Why is the Base64 output 33% larger than the input?
Base64 encodes every 3 bytes (24 bits) of input as 4 characters (32 bits — one 6-bit value per char). That's a fixed 4/3 expansion, plus up to 2 padding characters at the end. If size matters (SMS, QR codes), consider Base85 or Base91 — or better, don't encode in the first place.
Is this tool RFC 4648 compliant?
Yes. Both the standard alphabet (§4) and the URL-safe alphabet (§5) are implemented faithfully. Padding is preserved by default and stripped only when you ask for it. Line wrapping uses the MIME standard 76-character width (§3.1) when enabled.
Related tools
- URL Encoder / Decoder — percent-encode and decode URLs and query strings
- JWT Decoder — decode and inspect JSON Web Tokens with algorithm and claim details
- Hash Generator — generate MD5, SHA-1, SHA-256, and SHA-512 hashes
- JSON Formatter — Format, validate, and beautify JSON online. 100% client-side — your data never leaves your browser.
- UUID Generator — Generate UUID v4 and v7 identifiers in bulk.
Related articles
- 4 min readBase64 PDF Embedding — Inline PDFs in HTML, JSON APIs, and EmailEmbed PDF files as Base64 strings in HTML data URIs, JSON API responses, and email attachments. Learn when Base64 embedding makes sense, the size overhead, and alternatives...
- 4 min readBase64 vs Hex Encoding — When to Use EachCompare Base64 and hex encoding for binary data. Learn which is more compact, when to use each in APIs, cryptography, and storage, with JavaScript and Python examples.
- 4 min readBase64 Encoding on the Command Line — Linux, macOS, and WindowsEncode and decode Base64 on the command line using base64, openssl, and PowerShell. Includes piping files, multiline input, URL-safe Base64, and common use cases like encoding...
- 5 min readBase64 Data URLs — Embed Images, Fonts, and Files in HTML and CSSBase64 data URLs encode binary files as text strings for embedding directly in HTML, CSS, or JSON. Here's how data URLs work, the correct format, and when to use them vs...
- 6 min readBase64 Encode Online — Encode Text and Files to Base64 InstantlyBase64 encoding converts binary data into printable ASCII text. It's used in email attachments, data URLs, JWT tokens, and API authentication. Here's how encoding works and...
- 5 min readBase64 Decode Online — Decode Base64 Strings to Text or FilesBase64 decoding reverses the encoding process, converting base64 strings back to the original binary data or text. Here's how decoding works, where you'll encounter encoded...
Pillar
Part of Encoding & Crypto — Base64, URL, JWT, hashes, UUID, QR, password.
Written and maintained by Mian Ali Khalid. Last updated 2026-05-12.