Base64 Encode & Decode

Convert text to Base64 and back — with full UTF-8 support and a URL-safe option — instantly and privately in your browser.

🔒 Runs entirely in your browser — nothing you type is uploaded or stored on a server.

The Base64 tool encodes text to Base64 and decodes it back again. Switch direction with one click: Text → Base64 turns any string into the compact ASCII form used all over the web, and Base64 → Text reverses it. The result updates as you type, ready to copy or download, with clear error messages if the input you paste isn't valid Base64.

Also on Txtset: generate MD5 and SHA cryptographic hashes · encode and decode Base64 strings · decode a JSON Web Token instead.

Base64 represents binary or text data using only 64 safe ASCII characters, so it can travel through channels that only handle plain text — data URIs, JSON and XML payloads, email attachments (MIME), HTTP headers and JWT tokens. This tool handles full Unicode correctly: it encodes text as UTF-8 first, so emoji and accented letters round-trip perfectly instead of being mangled the way a naïve btoa() would mangle them.

Need the output to sit safely inside a URL or filename? Turn on URL-safe (base64url) and the + and / characters become - and _ with the padding removed — the variant used by JWTs and many APIs. Decoding accepts both standard and URL-safe input automatically. It all runs in your browser, so tokens and private data are never uploaded.

How to use

  1. Pick a direction: “Text → Base64” to encode, or “Base64 → Text” to decode.
  2. Type or paste your input — the result appears instantly below.
  3. Turn on “URL-safe” if the Base64 needs to go into a URL, filename or JWT.
  4. Copy or download the result, or press “Use result as input” to chain a conversion.
  5. If decoding fails, check the error message — it tells you what's wrong with the input.

Examples

Encode text
“Man” becomes “TWFu”; “Hello, 世界 👋” encodes as valid UTF-8 Base64 that decodes back exactly.
Decode a token
Paste the payload segment of a JWT to read the JSON claims inside it.
URL-safe output
Turn on URL-safe to get base64url (- and _ instead of + and /, no padding) for use in links and tokens.
Data URI
Encode a small snippet of text or SVG to embed it directly in a data: URL.

Frequently asked questions

What is Base64 used for?
It encodes data using 64 plain-ASCII characters so binary or text can pass safely through systems built for text — data URIs, JSON/XML payloads, email (MIME), HTTP headers and tokens like JWTs. It's an encoding, not encryption: anyone can decode it.
Does it handle emoji and accented characters?
Yes. Text is encoded as UTF-8 before Base64, so Unicode — emoji, accents, non-Latin scripts — round-trips perfectly. This avoids the corruption you'd get from the browser's raw btoa(), which only handles Latin-1.
What is URL-safe Base64 (base64url)?
A variant that replaces the + and / characters with - and _ and drops the = padding, so the result is safe to put in URLs, filenames and JWTs. Turn on the URL-safe option to produce it; decoding accepts it automatically.
Is Base64 encryption?
No. Base64 is reversible encoding with no key — it provides zero security. Anyone can decode it back to the original. Never use it to protect passwords or secrets; use real encryption for that.
Why did decoding fail?
The input contains characters that aren't valid Base64, or its length is wrong. The tool shows a specific error. Make sure you pasted the complete Base64 string (both standard and URL-safe forms are accepted).
Is my data uploaded?
No. Encoding and decoding run entirely in your browser, so tokens, payloads and private text never leave your device.