64

Base64 Encoder / Decoder

Encode text or files to Base64 and decode Base64 strings back to text. Supports URL-safe Base64URL, MIME line wrapping, file Data URLs with image preview, and a full Base64 alphabet reference.

Text & FileURL-safe Base64URLData URL OutputImage PreviewFree & Private
Line wrap

Common Uses for Base64

πŸ–ΌοΈ

Inline Images (Data URLs)

Embed small images directly in HTML or CSS as data:image/png;base64,... to eliminate HTTP requests for icons and thumbnails.

πŸ”‘

JWT Tokens

JSON Web Tokens use Base64URL encoding for their header and payload segments. The URL-safe variant avoids + and / which break in URLs.

πŸ“§

Email Attachments (MIME)

The MIME standard uses Base64 to encode binary attachments so they can be transmitted safely through text-based email servers.

πŸ“‘

API Payloads

Pass binary data (images, PDFs, audio) inside JSON request bodies by encoding them as Base64 strings in the payload.

πŸ”

HTTP Basic Auth

Basic authentication encodes credentials as Base64 in the Authorization header: Basic dXNlcjpwYXNz β€” though this is not encryption.

πŸ”€

Fonts & SVG in CSS

Embed web fonts or SVG icons directly in a stylesheet using Base64 Data URLs to ship a single self-contained CSS file.

Frequently Asked Questions

What is Base64 encoding?+

Base64 is a binary-to-text encoding scheme that represents binary data using 64 printable ASCII characters (A–Z, a–z, 0–9, +, /). It converts every 3 bytes of input into 4 Base64 characters. It is used to safely transmit binary data through text-based systems like email, JSON, and HTML that may not handle raw binary.

Why is Base64 used?+

Base64 is used whenever binary data needs to travel through a channel designed for text. Common uses: embedding images directly in HTML/CSS as Data URLs, storing binary data in JSON payloads, encoding email attachments (MIME), passing tokens in HTTP headers, and embedding fonts or scripts in web pages.

What is URL-safe Base64 (Base64URL)?+

Standard Base64 uses + and / characters which have special meaning in URLs. URL-safe Base64 (Base64URL, defined in RFC 4648) replaces + with - and / with _ so the encoded string can be used safely in URLs and filenames without percent-encoding. JWT tokens, for example, use Base64URL encoding.

What is a Base64 Data URL?+

A Data URL embeds file content directly in an HTML or CSS document using the format: data:[mediatype];base64,[data]. For example, a small PNG can be embedded as data:image/png;base64,iVBORw... This eliminates an extra HTTP request but increases the document size by ~33%.

Is Base64 the same as encryption?+

No. Base64 is encoding, not encryption. It provides no security β€” anyone can decode a Base64 string instantly with any decoder. It only changes the representation of data to make it safe for text channels. If you need to protect data, use actual encryption (AES, RSA, etc.) not Base64.

How much does Base64 increase file size?+

Base64 increases file size by approximately 33% because it encodes every 3 bytes as 4 characters. A 100 KB image becomes ~133 KB as Base64. MIME line wrapping adds a further 2 bytes per 76-character line (the newlines). This overhead is why Base64 Data URLs are best suited for small assets.

What is MIME line wrapping?+

The MIME email standard (RFC 2045) requires Base64-encoded content to be split into lines of at most 76 characters, separated by CRLF. Some older systems and email clients require this format. For web use (Data URLs, JWT), line wrapping should not be used β€” it breaks the string.

What is the Base64 padding character (=)?+

Base64 encodes 3 bytes into 4 characters. If the input length is not a multiple of 3, padding = characters are added to make the output length a multiple of 4. Base64URL often omits padding since the length can be inferred. Standard Base64 for MIME and most protocols requires padding.

More Developer Tools

Free encoding, decoding, and text tools β€” all instant and private.

See MDN: Base64 and RFC 4648 β€” Base64 Data Encodings.