Base64 Encode / Decode

Base64 Encoder & Decoder

Encode text to Base64 or decode Base64 back to plain text

Plain Text
Base64 Output
Output will appear here...

Free Online Base64 Encoder & Decoder

Encode any text to Base64 or decode Base64 strings back to plain text instantly. Our tool supports UTF-8 encoding, URL-safe Base64 (RFC 4648), and shows input/output sizes with compression ratios. Everything runs in your browser — your data never leaves your device.

What is Base64?

Base64 is a binary-to-text encoding scheme that represents binary data using 64 printable ASCII characters (A-Z, a-z, 0-9, +, /). It's commonly used to encode data that needs to be transmitted over text-based protocols like email (MIME), HTML (data URIs), JSON (API payloads), and URLs.

Base64 encoding increases the data size by approximately 33% (every 3 bytes of input becomes 4 bytes of output). This tradeoff is acceptable because it guarantees the encoded data contains only safe ASCII characters that won't be corrupted during transmission.

How Base64 Encoding Works

Base64 converts every 3 bytes of input into 4 ASCII characters. Here's how the word “Man” is encoded step by step:

StepMan
ASCII value7797110
Binary010011010110000101101110
Combined (24 bits)010011 010110 000101 101110
Base64 index19 → T    22 → W    5 → F    46 → u
ResultTWFu

When the input length is not a multiple of 3, padding characters (=) are added to the output. For example, “Ma” encodes to “TWE=” (one padding character), and “M” encodes to “TQ==” (two padding characters).

The Base64 Alphabet

The standard Base64 alphabet consists of 64 characters plus the padding character:

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9 + / (padding: =)

Standard vs URL-Safe Base64

FeatureStandard (RFC 4648)URL-Safe
CharactersA-Z, a-z, 0-9, +, /A-Z, a-z, 0-9, -, _
Padding= (required)No padding
Safe in URLsNo (+ and / need escaping)Yes
Use caseEmail, HTML, JSON, APIsURLs, filenames, tokens

Common Uses for Base64

Data URIs

Embed images, fonts, and other files directly in HTML/CSS using data:image/png;base64,...

Email attachments

MIME encoding uses Base64 to safely transmit binary files through email servers

API payloads

Encode binary data in JSON API requests and responses where only text is allowed

JWT tokens

JSON Web Tokens use Base64url encoding for the header and payload segments

Basic auth

HTTP Basic Authentication encodes username:password as Base64 in the Authorization header

Storing binary in text

Database fields, config files, and environment variables that only support text strings

Frequently Asked Questions

No. Base64 is encoding, not encryption. It transforms data into a different representation but provides zero security. Anyone can decode Base64 instantly. Never use Base64 to protect sensitive data — use proper encryption (AES, RSA) instead.

Base64 represents every 3 bytes of input as 4 ASCII characters, resulting in a ~33% size increase. This is the tradeoff for ensuring the data only contains safe, printable characters.

Standard Base64 uses + and / which have special meaning in URLs. URL-safe Base64 replaces + with - and / with _, and removes padding (=). This makes it safe to use in URLs, filenames, and query parameters without additional escaping.

Yes. Everything runs in your browser using JavaScript’s built-in btoa() and atob() functions. Your text never leaves your device — nothing is uploaded or stored.

Yes. We handle UTF-8 encoding properly, so you can encode and decode text in any language including emoji, CJK characters, and special symbols.

There’s no hard limit, but very large inputs (10MB+) may slow your browser since everything runs client-side. For typical text encoding, it’s instant.