🔡Base64 Encoder / Decoder

Encode text to Base64 or decode Base64 to text — live, bidirectional, full Unicode.

Plain text
Base64

Base64 encode decode online — free, accurate, private

Working with Base64? Our free Base64 Encoder / Decoder converts both ways instantly. Paste plain text to encode it to Base64, or paste Base64 to decode it back to readable text — change either side and the result updates live, with no buttons to hunt for. It handles full Unicode correctly using the TextEncoder and TextDecoder APIs, so emoji, accented characters, and non-Latin scripts encode and decode without getting mangled — unlike bare btoa/atob, which only handle Latin-1.

It covers the cases developers actually hit: switch on the URL-safe variant for Base64 that replaces + and / with - and _, making it safe to drop into URLs and tokens without percent-encoding. Toggle No padding to strip the trailing = characters. Optionally encode a file to a Base64 data URI right in your browser — handy for embedding small images or assets. Decoding invalid input gives you a clear error instead of garbled output. Everything runs locally and never touches a server, so you can safely work with sensitive strings like API keys or tokens.

About the Base64 Encoder / Decoder

Features

Two-way live conversion

Type in either field — Plain text or Base64 — and the other updates instantly. No separate encode/decode buttons.

Full Unicode / UTF-8

Uses TextEncoder and TextDecoder internally so emoji, accents, and non-Latin scripts round-trip correctly — unlike bare btoa/atob.

URL-safe variant

Toggle URL-safe to replace + and / with - and _ so the output can be dropped into a URL, filename, or JWT without percent-encoding.

No-padding option

Strip trailing = padding characters from the encoded output — required by some systems like JWTs. The decoder restores padding automatically.

File to data URI

Switch to File mode and drop any file to encode it as a Base64 data URI — useful for embedding small images in HTML, CSS, or JSON.

Decode validation

Malformed Base64 input shows a specific error message instead of silently producing garbled output or crashing.

Fully client-side

No server round-trips, no analytics on your input. API keys, tokens, and credentials stay in your browser.

Mobile-friendly

Fields stack vertically on small screens with no overflow. All features — encoding, decoding, file mode — work on mobile browsers.

Why standard btoa() breaks on Unicode

Browsers' built-in btoa() and atob() only accept Latin-1 (ISO 8859-1) characters. Any character with a code point above 255 — including emoji, Chinese, Arabic, or most accented European characters — throws a InvalidCharacterError. This tool avoids the problem by first encoding the string to UTF-8 bytes via TextEncoder, then base64-encoding the byte sequence. Decoding reverses this: base64 → bytes → TextDecoder → string.

Common uses for Base64

Base64 appears in many places developers work with daily: HTTP Basic Auth headers encode credentials as Base64(username:password); JSON Web Tokens (JWT) use URL-safe Base64 without padding for their header and payload sections; data: URIs embed images and fonts directly in HTML, CSS, or SVG; email attachments travel as MIME multipart bodies encoded in Base64; environment variables and configuration files sometimes store binary secrets as Base64 strings.

Frequently Asked Questions

How does the Base64 Encoder / Decoder work?

Paste text in the Plain text field to encode it to Base64, or paste Base64 in the right field to decode it back to text. Either field updates the other instantly as you type — no button needed.

Is this Base64 tool free?

Completely free. No sign-up, no download, no rate limits, no limits on input length.

What is Base64?

Base64 is an encoding scheme that represents binary data or arbitrary text as a string of ASCII characters using an alphabet of 64 symbols (A–Z, a–z, 0–9, +, /). It is widely used to transmit binary data in text-only contexts such as JSON payloads, email attachments (MIME), data URIs, and HTTP Basic Auth headers.

Does it handle emoji and accented characters correctly?

Yes. The tool encodes text to UTF-8 bytes first using the TextEncoder API, then converts to Base64 — so emoji, accented letters, and non-Latin scripts all round-trip correctly. Browsers' built-in btoa() and atob() are limited to Latin-1 and corrupt these characters; this tool avoids that problem entirely.

What is URL-safe Base64?

Standard Base64 uses + and / characters, which have special meaning in URLs and must be percent-encoded. URL-safe Base64 replaces + with - and / with _ so the result can be placed directly in a URL, filename, or HTTP header without further encoding. Toggle "URL-safe" to switch. The decoder accepts both variants automatically.

What does "No padding" mean?

Standard Base64 output is padded with = characters to make the length a multiple of 4. Some systems (JWT, for example) strip this padding. Toggle "No padding" to omit the = characters from the encoded output. The decoder handles unpadded input automatically by restoring the padding before decoding.

Can I encode a file to Base64?

Yes. Switch to the File tab, drop a file or click to browse, and the tool encodes it to a Base64 data URI in your browser. You can copy the full data URI (useful for embedding images in HTML or CSS) or just the raw Base64 string. No file is uploaded anywhere.

Why am I getting a decode error?

The input is not valid Base64. Common causes: invalid characters (only A–Z, a–z, 0–9, +, /, =, -, _ are allowed), incorrect length (Base64 without padding must be a length divisible by 4 after padding is restored), or corrupted data. The error message tells you exactly what is wrong.

Is my data sent to a server?

No. All encoding and decoding happens entirely in your browser using JavaScript. Nothing is sent to any server, so sensitive strings like API keys, tokens, or credentials stay on your device.

Does it work on mobile?

Yes. The layout is fully responsive. On small screens the two fields stack vertically so both are easy to read and interact with. All features — encoding, decoding, URL-safe, file mode — work on mobile browsers.