X Xerobit

Base64 Encoder / Decoder

Encode text and files to Base64, or decode Base64 back to text. Runs entirely in your browser — your data, tokens, and files never hit our servers. Supports URL-safe variant, line wrapping, and proper UTF-8 handling.

Shortcuts: Ctrl/⌘ + Enter re-run · Ctrl/⌘ + Shift + C copy

Live Market Insight

Source: DataForSEO · Updated 2026-04-25
Monthly searches (US)
74,000
keyword: "base64 decoder"
Keyword CPC
$10.75
avg. advertiser bid
Cluster size
4 keywords
base64 + decoder + encode + online
Top competitor
base64decode.org
5/10 SERPs

How to use the Base64 Encoder / Decoder

  1. Pick a mode: Encode (text → Base64), Decode (Base64 → text), or Auto (detects from input).
  2. Paste into the left textbox. Processing runs automatically after 200ms.
  3. Toggle options as needed: URL-safe (-_ instead of +/), No padding (strip trailing =), Wrap 76 (MIME-style line wrapping).
  4. For files, click Upload file (up to 10MB). The output is a full data: URL ready to paste into HTML or CSS.
  5. Copy with the Copy button or Ctrl/⌘ + Shift + C.

What is Base64?

Base64 is a way 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 (every 3 bytes of input become 4 characters of output).

Base64 is not encryption. It's a reversible encoding — anyone who sees the encoded string can decode it back to the original. Use it for transport, not secrecy.

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.

When to use Base64 (and when not to)

Good use cases:

Bad use cases:

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

Is the Base64 encoder 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

Further reading

Pillar

Part of Encoding & Crypto — Base64, URL, JWT, hashes, UUID, QR, password.


Written and maintained by Mian Ali Khalid. Last updated 2026-04-25.