converter.base64.input (Text)
Loading Editor...
converter.base64.mode
converter.base64.output (Base64)
Loading Editor...

Base64 Encode & Decode — Binary to Text, Instantly

It's not encryption. It's safe transport.

You have an image, a PDF, or a UTF-8 string. You need to send it through JSON, store it in a cookie, or embed it in a URL. But binary data breaks text-based protocols.

Base64 is the bridge. It translates complex binary data into a safe, printable alphabet of 64 characters (A-Z, a-z, 0-9, +, /). Paste your text or file above. We convert it instantly — handling UTF-8 characters correctly where other tools fail.

How Base64 Actually Works

The Logic

Computers store data in bytes (8 bits). Base64 groups consecutive bits into chunks of 6 bits.

Since 2⁶ = 64, each 6-bit chunk maps perfectly to one of the 64 characters in the Base64 alphabet.

This simple shift turns 3 bytes of binary data into 4 characters of text. This is why Base64 encoded files are roughly 33% larger than the original.

ExampleInput: "Man"

ASCII: M (77) a (97) n (110)

Bits: 01001101 01100001 01101110

Regroup 24 bits into 4 x 6 bits:

010011 010110 000101 101110

Index: 19, 22, 5, 46

Base64: T W F u

4 Common Base64 Pitfalls

The UTF-8 Monster

Standard window.btoa() fails on emojis or non-Latin characters (like '🚀' or '你好'). Our tool handles this by escaping the string first, ensuring multi-byte characters encode correctly.

Padding Errors (=)

Base64 strings are padded with '=' signs to ensure the length is a multiple of 4. Removing them breaks standard decoders. Always keep the padding unless you're using a specific 'unpadded' library.

URL Safety

Standard Base64 uses '+' and '/'. These are special characters in URLs. For URLs, use 'Base64Url' encoding (replace '+' with '-' and '/' with '_').

Size Inflation

Base64 increases file size by ~33%. Never store large files (videos, huge images) as Base64 in your database. It wastes storage and slows down network requests.

Frequently Asked Questions

Is Base64 encryption?

NO. This is a dangerous misconception. Base64 is encoding, not encryption. It hides nothing. Anyone can decode it instantly without a key. Never use Base64 to 'secure' passwords or secrets.

Why do some Base64 strings end with =?

The '=' is padding. Base64 encodes 3 bytes into 4 characters. If the input data length isn't divisible by 3, '=' characters are added to the end to make the output string length a multiple of 4.

Can I convert an image to Base64?

Yes. This is commonly used in web development ('Data URIs') to embed small icons directly into CSS or HTML, saving a network request. Our tool supports file upload for this exact purpose.

What is URL-Safe Base64?

Standard Base64 uses '+' and '/', which have special meanings in URLs. URL-Safe Base64 replaces '+' with '-' and '/' with '_', and often removes the padding '='.

Max input size?

Our tool runs in your browser, so it's limited by your available RAM. Generally, strings up to 10-50MB work fine, but gigabyte-sized files may crash the tab.

Related Developer Tools