PureDevTools

Base64 Encoder / Decoder

Encode and decode Base64 — text, files, and data URIs, all in your browser

All processing happens in your browser. No data is sent to any server.

Encoding Variant

RFC 4648 standard Base64 — uses + / and = padding

Type or paste text above to see the Base64-encoded result.

What Is Base64 Encoding?

Base64 is a binary-to-text encoding scheme that converts binary data into a sequence of 64 printable ASCII characters. The character set consists of A–Z, a–z, 0–9, +, and /, with = used as a padding character to make the output length a multiple of four.

Base64 is not encryption — it is encoding. Its purpose is to allow binary data to pass safely through text-based systems and protocols. Common applications include:

The output of Base64 encoding is approximately 33% larger than the original data because every 3 bytes of input produce 4 ASCII characters of output.

Standard vs URL-safe Base64

There are two widely-used Base64 variants defined in RFC 4648:

Standard Base64 (RFC 4648 §4)

Standard Base64 uses + and / as the 62nd and 63rd characters, and pads the output with = to align to a four-character boundary.

Input:  Hello, World!
Output: SGVsbG8sIFdvcmxkIQ==

Standard Base64 is the most widely supported form, used in MIME encoding and most general-purpose libraries.

URL-safe Base64 (RFC 4648 §5)

URL-safe Base64 replaces + with - and / with _, producing strings that can be used directly in URLs, file names, and HTTP headers without percent-encoding. Padding characters are typically omitted.

Input:  Hello, World!
Output: SGVsbG8sIFdvcmxkIQ

URL-safe Base64 is the standard for:

How to Encode Text to Base64

Type or paste any text into the Encode tab. The tool produces the Base64 output instantly as you type. Because the browser’s native btoa() function only handles bytes (not Unicode strings), this tool first converts your text to UTF-8 bytes using the TextEncoder API before applying Base64 encoding. This ensures correct results for all characters including Chinese (中文), Japanese (日本語), Arabic (العربية), and emoji (🚀).

To switch to URL-safe output, select the URL-safe variant — the result replaces + with -, / with _, and removes the = padding.

How to Decode Base64

Switch to the Decode tab and paste your Base64 string. The tool applies the reverse process: it decodes the Base64 characters back to bytes, then interprets those bytes as UTF-8 text using the TextDecoder API.

If the input contains characters that are not valid Base64 (such as !, @, or #), the tool will display an error rather than produce incorrect output. In that case, check that the string was not accidentally truncated or corrupted, and verify whether you need the URL-safe variant.

How to Encode Files to Base64

The File tab accepts any file — images, PDFs, audio, video, binaries, or text files. Drag and drop a file onto the drop zone, or click to browse. The file is read locally using the FileReader API; nothing is uploaded to any server.

The tool reads the file as raw binary data (an ArrayBuffer) and converts it to a Base64 string. You can optionally enable the Include data URI prefix option, which prepends the MIME type like:

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...

This format can be used directly in HTML:

<img src="data:image/png;base64,iVBORw0KGgo..." alt="Embedded image" />

Or in CSS:

background-image: url("data:image/svg+xml;base64,PHN2ZyB...");

Common Use Cases for Developers

API authentication: Many APIs use Base64 to encode credentials in the Authorization header — for example, HTTP Basic Auth sends username:password encoded as Base64.

JWT inspection: JWTs consist of three Base64url-encoded segments separated by dots. Paste a JWT into the Decode tab (and switch to URL-safe) to read the header and payload claims.

Embedding small assets: For small images, icons, or inline SVGs, embedding them as Base64 data URIs eliminates an HTTP request, which can improve performance for above-the-fold content.

Clipboard and export: When a binary value (such as a file hash, public key, or UUID) must be stored in a text file or config, Base64 provides a compact, copy-pasteable representation.

Debugging binary protocols: When working with binary wire formats (Protobuf, MessagePack, TLS), Base64 lets you inspect or log byte sequences in a readable form.

Frequently Asked Questions

Is Base64 the same as encryption? No. Base64 is reversible encoding, not encryption. Anyone who sees a Base64-encoded string can decode it instantly. If you need to protect data, use proper encryption such as AES-GCM. Base64 is used only to make binary data safe for text environments.

Why does the Base64 output end with == or =? Base64 encodes 3 input bytes into 4 output characters. When the input length is not a multiple of 3, the output is padded with = characters to fill the final 4-character group. Two equals signs (==) means 1 remainder byte; one equals sign (=) means 2 remainder bytes.

What is the size overhead of Base64? Every 3 bytes of input produces 4 Base64 characters, so Base64 output is ⌈n/3⌉ × 4 characters long — approximately 33.3% larger than the original. For example, a 1 MB file becomes about 1.37 MB in Base64.

Can I use Base64 for passwords? No. Encoding is not hashing. Passwords should be stored as salted hashes using a purpose-built algorithm such as bcrypt, Argon2, or scrypt — never stored in Base64 or any other reversible encoding.

Is my data private when using this tool? Yes. All encoding and decoding happens in your browser using native JavaScript APIs (TextEncoder, TextDecoder, btoa, atob, and FileReader). No data is ever sent to a server. Files are processed entirely locally.

Related Tools