Pulsars

Base64 Encode & Decode Online

URL-safe
13 chars
20 chars

Base64 is a binary-to-text encoding scheme defined in RFC 4648 that represents binary data as a string of ASCII characters. It uses a 64-character alphabet (A-Z, a-z, 0-9, +, /) and padding with '='. Base64 is used in email attachments (MIME), data URIs in HTML/CSS, JSON Web Tokens (JWT), and HTTP Basic Authentication. The URL-safe variant replaces '+' with '-' and '/' with '_' to avoid encoding issues in URLs.

What is Base64 Encoding?

Base64 is a binary-to-text encoding scheme that converts binary data into a string of 64 printable ASCII characters: A-Z, a-z, 0-9, +, and /, plus = for padding. It was originally designed to transmit binary data over protocols that only support text, like SMTP (email) or early HTTP.

The encoding works by taking groups of 3 bytes (24 bits) and splitting them into 4 groups of 6 bits. Each 6-bit group maps to one of the 64 characters. If the input length isn't a multiple of 3, padding (=) is added to the output.

When should you use Base64 encoding?

Base64 is the right tool when you need to embed binary data in a text-only context:

Base64 is not encryption. It's trivially reversible. Never use it to hide secrets or sensitive data.

What is the difference between URL-safe and standard Base64?

Standard Base64 uses + and / as two of its 64 characters, and = for padding. These characters have special meaning in URLs and filenames, which can cause issues when embedding Base64 in query strings, URL fragments, or file paths.

URL-safe Base64 (defined in RFC 4648 §5) solves this by replacing + with -, / with _, and omitting trailing = padding. This variant is used by JWT, many APIs, and anywhere Base64 appears in a URL context.

Working with API data formats? Our JSON ↔ YAML converter lets you switch between the two most common configuration formats instantly.

Frequently Asked Questions

What is Base64 encoding?

+

Base64 is a binary-to-text encoding that represents binary data using 64 printable ASCII characters (A-Z, a-z, 0-9, +, /). It's used to safely transmit binary data over text-based protocols like email or HTTP.

What is the difference between standard and URL-safe Base64?

+

Standard Base64 uses + and / characters, which have special meaning in URLs. URL-safe Base64 replaces + with - and / with _, and removes trailing = padding, making it safe for query strings and filenames.

Does Base64 encoding encrypt data?

+

No. Base64 is an encoding, not encryption. Anyone can decode a Base64 string — it provides zero security. Use it only for safe transport of binary data, never to hide sensitive information.

Why does Base64 increase the size of data?

+

Base64 encodes every 3 bytes of input into 4 ASCII characters, resulting in a ~33% size increase. This overhead is the trade-off for being able to represent binary data as plain text.

Where is Base64 commonly used?

+

Base64 is used in data URIs (embedding images in HTML/CSS), email attachments (MIME), JSON Web Tokens (JWT), HTTP Basic Authentication headers, and storing binary blobs in text-based formats like JSON or XML.

Related Tools