One Developer Tools

Base64 Encoder / Decoder

Quickly serialize regular human-readable unicode text into Base64 formats, or decrypt Base64 hashes securely in-browser.

Plain Text Input (UTF-8)
Base64 Encoded Output
Awaiting Output

Understanding Base64 & How to Use the Base64 Encoder/Decoder

Base64 is a binary-to-text encoding that uses 64 printable characters to represent each 6-bit segment of a sequence of byte values. As for all binary-to-text encodings, Base64 encoding enables transmitting binary data on a communication channel that only supports text.

When comparing the original data to the resulting encoded data, Base64 encoding increases the size by 33% plus about 4% additional if inserting line breaks for typical line length.

The earliest uses of this encoding were for dial-up communication between systems running the same operating system – for example, uuencode for UNIX and BinHex for the TRS-80 (later adapted for the Macintosh) – and could therefore make more assumptions about what characters were safe to use. For instance, uuencode uses uppercase letters, digits, and many punctuation characters, but no lowercase.

Applications

Notable applications of Base64:

Web pages

Base64 encoding is prevalent on the World Wide Web where it is often used to embed binary data such as a digital image in text such as HTML and CSS.

E-mail attachments

Base64 is widely used for sending e-mail attachments, because SMTP – in its original form – was designed to transport 7-bit ASCII characters only. Encoding an attachment as Base64 before sending, and then decoding when received, assures older SMTP servers correctly transmit messages with attached binary information.

Embed binary data in a text file

For example, to include the data of an image in a script to avoid depending on external files.

Embed binary data in XML

To embed binary data in an XML file, using a syntax similar to <data encoding="base64">...</data> e.g. favicons in Firefox's exported bookmarks.html.

PDF files

To embed a PDF file in an HTML page.

Embedded elements

Although not part of the official specification for the SVG format, some viewers can interpret Base64 when used for embedded elements, such as raster images inside SVG files.

Preventing delimiter collisions

To transmit and store text that might otherwise cause delimiter collision.

LDAP Data Interchange Format

To encode character strings in LDAP Data Interchange Format files.

Data URI schemes

The data URI scheme can use Base64 to represent file contents. For instance, background images and fonts can be specified in a CSS stylesheet file as data: URIs, instead of being supplied in separate files.

Leverage clipboard

To store/transmit relatively small amounts of binary data via a computer's text clipboard functionality, especially in cases where the information doesn't warrant being permanently saved or when information must be quickly sent between a wide variety of different, potentially incompatible programs. An example is the representation of the public keys of cryptocurrency recipients as Base64 encoded text strings, which can be easily copied and pasted into users' wallet software.

Support human verification

Binary data that must be quickly verified by humans as a safety mechanism, such as file checksums or key fingerprints, is often represented in Base64 for easy checking, sometimes with additional formatting, such as separating each group of four characters in the representation of a PGP key fingerprint with a space.

QR code encoding

A QR code, which contains binary data, is sometimes stored as Base64 since it is more likely that a QR code reader accurately decodes text than binary data. Also, some devices more readily save text from a QR code than potentially malicious binary data.

Alphabet

The set of characters used to represent the values for each base-64 digit (value from 0 to 63) differs slightly between the variations of Base64. The general strategy is to use printable characters that are common to most character encodings. This tends to result in data remaining unchanged as it moves through information systems, such as email, that were traditionally not 8-bit clean. Typically, an encoding uses A–Z, a–z, and 0–9 for the first 62 values. Many variants use + and / for the last two.

Per RFC 4648 §4, the following table lists the characters used for each numeric value. To indicate padding, = is used.

Base64URL encoding replaces + with - and / with _ to make the encoded string HTTP-safe and avoid the need for escaping.

Examples

To simplify explanation, the example below uses plain text for input. While this is done in practice, a much more common use is encoding images and other data that are normally not representable with plain text, and the result then represents the data in a printable text format.

For the input data:

Many hands make light work.

The typical Base64 representation is:

TWFueSBoYW5kcyBtYWtlIGxpZ2h0IHdvcmsu

Encoding when no padding needed

Each input sequence of 6 bits (which can encode 26 = 64 values) is mapped to a Base64 alphabet letter. Therefore, Base64 encoding results in four characters for each three input bytes. Assuming the input is ASCII or similar, the byte-data for the first three characters 'M', 'a', 'n' are values 77, 97, and 110 which in 8-bit binary representation are 01001101, 01100001, and 01101110. Joining these representations and splitting into 6-bit groups gives:

010011 010110 000101 101110

Which encodes the string TWFu (per ASCII or similar).

The following table shows how input is encoded. For example, the letter 'M' has the value 77 (per ASCII and similar). The first 6 bits of the value is 010011 or 19 decimal which maps to Base64 letter 'T' which has a value 84 (per ASCII and similar).

Encoding with one padding character

If the input consists of a number of bytes that is 2 more than a multiple of 3 (e.g. 'M', 'a'), then the last 2 bytes (16 bits) are encoded in 3 Base64 digits (18 bits). The two least significant bits of the last content-bearing 6-bit block are treated as zero for encoding and discarded for decoding (along with the trailing = padding character).

Encoding with two padding characters

If the input consists of a number of bytes that is 1 more than a multiple of 3 (e.g. 'M'), then the last 8 bits are represented in 2 Base64 digits (12 bits). The four least significant bits of the last content-bearing 6-bit block are treated as zero for encoding and discarded for decoding (along with the trailing two = padding characters):

Decoding with padding

When decoding, each sequence of four encoded characters is converted to three output bytes, but with a single padding character the final 4 characters decode to only two bytes, or with two padding characters, the final 4 characters decode to a single byte. For example:

How to Use Our Base64 Encoder/Decoder Tool

Enter text or data to safely encode it to Base64, or paste a Base64 string to decode it back to readable text. All conversions happen client-side.

Using this tool is incredibly simple and entirely browser-based. This architectural approach guarantees that your raw inputs, passwords, and sensitive system configurations are never transmitted to a remote server. You achieve instantaneous results, eliminating network latency and enhancing productivity during development.

Why Developers Rely on Base64 Utilities

In modern software engineering, dealing with raw, unformatted, or minified data can severely slow down debugging processes. Utilities like this Base64 Encoder/Decoder transform dense and complex structures into readable, structured formats. It allows developers to quickly spot syntax errors, validate structures against expected schemas, and integrate standard protocols without manual parsing.

Whether you are migrating legacy code, integrating third-party APIs, or standardizing configuration files across a massive enterprise architecture, maintaining consistent standards through automation drastically reduces human error and technical debt.

Privacy and Security First

One of the core principles of One Developer Tools is uncompromised security. Unlike other online utilities that offload compute tasks to a backend server—thereby risking exposure of proprietary data—our Base64 Encoder/Decoder relies entirely on client-side Web APIs and modern JavaScript capabilities. We never store, log, or monitor your data. Once you close your tab, all traces of your session are eliminated from your local memory.