API & Auth

Base64 Encoder / Decoder

Convert text to Base64 and back — Unicode-safe, with an optional URL-safe output mode.

Your text is encoded and decoded locally in your browser. It is never uploaded to our servers.

How to use

  1. Type or paste your text into the input box.
  2. Click Encode to convert it to Base64, or Decode to convert Base64 back to plain text.
  3. Turn on URL-safe variant if the result will appear in a URL or filename.
  4. Use Swap to turn the current result into the new input (handy for stepping through multi-layer encodings).
  5. Copy the result with the Copy button.

What is Base64?

Base64 represents binary data as plain ASCII text by encoding every 3 bytes into 4 printable characters, using the alphabet A–Z a–z 0–9 + / with = as padding. That makes it roughly 33% larger than the original, but safe to transmit through systems that only understand text — email attachments, JSON payloads, and data: URIs are classic examples.

Base64 is an encoding, not encryption: anyone can decode it without a key. Never use it to protect secrets.

The URL-safe variant (RFC 4648 §5) replaces + with - and / with _, so the result can sit in URLs without further escaping — JWTs use exactly this variant. This tool also handles UTF-8 correctly, so emoji and non-Latin characters round-trip without corruption (a common bug with naive btoa() implementations).

Examples

Inspecting a JWT segment

JWT headers and payloads are Base64url-encoded JSON. Paste one segment here and click Decode to read it — or use our JWT Decoder for the whole token with security checks.

Embedding an image in HTML/CSS

Small images are often embedded as data:image/png;base64,... URIs. Use this tool to verify a pasted data URI decodes to what you expect.

Basic authentication headers

HTTP Basic Auth sends "Basic " + Base64(username:password). Decode an Authorization header to see which account it belongs to.

Debugging garbled text

If decoded Base64 shows mojibake, the original data was encoded with a different charset than UTF-8 — or the string is not Base64 at all. The error message tells you which.

Frequently Asked Questions

Is Base64 the same as encryption?+
No. Base64 is a reversible encoding with no key and no secrecy. It only makes binary data printable. Treat any Base64-encoded secret as plaintext.
Why do non-English characters break other Base64 tools?+
Many tools call btoa() directly, which only accepts Latin-1 characters. This tool converts text to UTF-8 bytes first, so Chinese, emoji, and other Unicode round-trip correctly.
What does the URL-safe option change?+
It swaps +// for -/_ and drops the = padding, per RFC 4648. Decoding accepts both variants automatically.
Can it decode Base64 from a file?+
Currently this tool works on text input. For binary files, copy the Base64 text representation (e.g. from a data URI) and paste it here.
How much bigger is Base64 output?+
About 4/3 of the input size (plus up to 2 padding characters). 3 bytes become 4 characters.
Where is Base64 used in JWTs?+
Both the header and the payload of a JWT are Base64url-encoded JSON. See our JWT Decoder & Analyzer to work with complete tokens.

Related Tools

Looking for something else? Browse all tools