Smart Unit ConvertersSmart Unit Converters

Base64 Encode / Decode

Encode text or files to Base64 (and back). UTF-8 safe + URL-safe variant supported.

Plain textBase64

?What is the Base64 Encode / Decode?

Base64 encodes binary data using only 64 printable ASCII characters (A-Z, a-z, 0-9, +, /). It's the standard way to embed binary content (images, files, encryption keys) in text-only contexts: email attachments (MIME), JSON payloads, data: URLs, JWT tokens, and Basic-Auth headers. This converter is fully UTF-8 safe — non-ASCII text like Urdu, Arabic, or emoji round-trips correctly. The optional URL-safe variant (RFC 4648 §5) replaces + with - and / with _ and drops padding, which is required for URL parameters and JWT segments.

The Formula

Base64: 3 binary bytes (24 bits) → 4 characters (6 bits each). Output size ≈ 4/3 × input size, rounded up to a multiple of 4 (with = padding).

Practical Examples

1

Embed a small image directly in HTML/CSS as a data: URL: `data:image/png;base64,iVBORw0KG…`.

2

JWT (JSON Web Token) segments are Base64URL-encoded — the URL-safe variant is critical here.

3

HTTP Basic-Auth: `Authorization: Basic ` + base64(username:password).

4

MIME email attachments use Base64 to fit binary files into 7-bit-clean SMTP transport.

5

Embedding small SVGs in CSS background-image properties.

Frequently Asked Questions

No — it's just an encoding. Anyone can decode it instantly. Don't use it to 'hide' sensitive data; use real encryption (AES, libsodium) for that.

Popular Conversions

Jump to a ready-made conversion — useful for quick reference and sharing: