nearnull

Base64 Encoder / Decoder

Encode text to Base64 or decode Base64 back to text, Unicode-safe. Runs entirely in your browser — nothing is sent to any server.

Result
Result will appear here

What is Base64 encoding?

Base64 turns arbitrary binary or text data into a string made only of letters, digits, `+`, `/` and `=` padding — safe to embed in places that only expect plain ASCII text, like JSON payloads, URLs, email attachments or config files. This tool encodes and decodes Unicode-safely: it routes text through UTF-8 bytes first, so accented characters and emoji round-trip correctly instead of throwing or getting mangled, which is a common pitfall with the raw `btoa`/`atob` browser functions.

Examples

Encode or decode Base64 natively in most languages:

JavaScript
btoa(unescape(encodeURIComponent(str))) // encode
decodeURIComponent(escape(atob(b64))) // decode
Python
import base64
base64.b64encode(s.encode()).decode()
base64.b64decode(b64).decode()
Java
Base64.getEncoder().encodeToString(bytes)
Base64.getDecoder().decode(b64)
C#
Convert.ToBase64String(bytes)
Convert.FromBase64String(b64)
Go
import "encoding/base64"

base64.StdEncoding.EncodeToString(b)
base64.StdEncoding.DecodeString(s)
PHP
base64_encode($str)
base64_decode($b64)
Ruby
require 'base64'
Base64.strict_encode64(str)
Base64.decode64(b64)

Use Cases

Embedding binary data in JSON or XML

Those formats are text-only — Base64 lets you inline a small image, file, or binary blob as a plain string field.

Basic HTTP authentication headers

The `Authorization: Basic <token>` header is just `username:password` Base64-encoded — decode one here to see exactly what it contains.

Reading data: URIs

Inline images and fonts in CSS/HTML (`data:image/png;base64,...`) carry their payload Base64-encoded — decode the tail to inspect it.

Inspecting JWT segments

A JWT's header and payload are Base64URL, a close variant of Base64 — decoding one here shows the same underlying idea before reaching for a dedicated JWT decoder.

Frequently Asked Questions

Is Base64 encryption?
No. Base64 is a reversible encoding, not encryption — anyone can decode it back to the original data with no key or password required. Never use it to protect secrets.
Why did decoding fail on my input?
The pasted text isn't valid Base64 (wrong characters or length), or it decodes to bytes that aren't valid UTF-8 text — for example, Base64 of an image or other binary file won't decode into readable text.
Does this handle emoji and accented characters correctly?
Yes. Encoding routes the string through its UTF-8 byte representation first, and decoding reverses that same path, so round-tripping text with emoji, accents, or any other Unicode characters works correctly.
Is my data sent to a server?
No. Encoding and decoding happen entirely in your browser with plain JavaScript. Nothing you type here is transmitted or stored anywhere.
What's the difference between Base64 and Base64URL?
Base64URL (used by JWTs and in URLs) replaces the `+` and `/` characters with `-` and `_`, and drops the `=` padding, so the result is safe to use directly inside a URL or filename without extra escaping. This tool produces standard Base64.