Base64 Decode & Encode Online

Paste your text or Base64 string below. Everything runs locally in your browser - nothing is uploaded or stored.

Input
Output
🔒 100% client-side - your data never leaves your browser
Advertisement

What is Base64 Encoding?

Base64 is a binary-to-text encoding scheme that converts binary data - such as images, files, or raw bytes - into a string made up of 64 printable ASCII characters: A-Z, a-z, 0-9, +, and /. An equals sign (=) is used for padding at the end of the string when needed.

Base64 was designed so that binary data could safely travel through systems that only reliably support text, such as email (MIME), JSON payloads, XML documents, URLs, and configuration files. Because every byte of input is mapped to printable characters, Base64 data can't be corrupted by line-ending conversions, character encoding issues, or non-printable byte stripping that plain binary data might suffer.

How Base64 Encoding Works

The encoder reads the input data three bytes (24 bits) at a time and splits those 24 bits into four 6-bit groups. Each 6-bit group (a value from 0–63) is mapped to one character in the Base64 alphabet. If the input length isn't a multiple of three bytes, the final group is padded with zero bits and one or two = characters are appended to the output to indicate how many padding bytes were added.

Decoding simply reverses this process: each character is converted back to its 6-bit value, the groups are reassembled into 8-bit bytes, and any padding is discarded. Because the result is binary data, decoding text that wasn't actually UTF-8 encoded Base64 may produce unreadable characters - this tool automatically handles UTF-8 text correctly, including emoji and non-Latin alphabets.

Common Use Cases for Base64

Embedding Images in HTML/CSS

Small images and icons can be embedded directly into HTML or CSS using a data: URI, avoiding an extra HTTP request. See our Image to Base64 and Base64 to Image tools.

Email Attachments (MIME)

Email protocols are text-based, so attachments such as PDFs, images, and documents are Base64-encoded before being included in the message body.

API Authentication & Tokens

HTTP Basic Authentication headers and JSON Web Tokens (JWTs) use Base64 (and Base64URL) to encode credentials and payloads. Try our Base64URL tool for JWT-safe encoding.

Storing Binary Data in JSON/XML

Since JSON and XML are text formats, binary fields (files, keys, hashes) are commonly Base64-encoded before being included. See our JSON to Base64 converter.

Frequently Asked Questions

Base64 is used to safely represent binary data (images, files, keys) as plain text so it can be embedded in formats like JSON, XML, HTML, CSS, email (MIME), and URLs that don't natively support raw binary.

No. Base64 provides zero security - it's purely a data representation format. Anyone can decode a Base64 string instantly with no key or password. Never use Base64 to "hide" sensitive information; use real encryption instead.

The equals signs are padding characters added when the input length isn't a multiple of 3 bytes. One = means the last group had 2 bytes of real data, and == means it had 1 byte. Padding can safely be removed for Base64URL.

This usually means the input contains characters outside the standard Base64 alphabet (e.g. spaces, line breaks copied from elsewhere, or URL-safe characters -/_). Try enabling "URL-safe Base64" above, or remove any extra whitespace.

No. All encoding and decoding happens locally in your browser using JavaScript's built-in btoa/atob functions. Nothing is uploaded, logged, or stored - your data stays on your device.

Base64URL replaces + with - and / with _, and typically drops the = padding, making the output safe to use inside URLs, filenames, and tokens like JWTs. See our dedicated Base64URL tool.

More Free Tools