tooliv

Codifica Base64

Codifica e decodifica Base64

Input

Result

Codifica Base64

What is Base64 encoding?

A method to encode binary data as ASCII text using 64 characters.

Why use Base64?

To safely transmit binary data in text-based formats like email, JSON, and HTML.

Does Base64 increase file size?

Yes, approximately 33% larger than the original.

Base64: Turning Binary Data Into Text You Can Actually Send

Base64 takes binary data -- the kind of stuff computers love but text systems choke on -- and converts it into plain ASCII characters. You'll find it everywhere: email attachments, images embedded directly in HTML, API authentication tokens. If you've ever seen a long string of random-looking letters and numbers ending in "==", that's Base64.

Does Base64 Make Files Bigger?

Yep, about 33% bigger. The trade-off is straightforward: every 3 bytes of original data become 4 ASCII characters. You gain compatibility (it works everywhere text works) but you lose some efficiency on file size.

How Base64 Actually Works Under the Hood

Base64 grabs 3 bytes (24 bits) of data and chops them into four groups of 6 bits each. Each 6-bit chunk maps to one of 64 characters -- A through Z, a through z, 0 through 9, plus (+), and slash (/). If the input doesn't divide evenly by 3, you get those "=" padding characters at the end. The result? Any binary data -- images, files, whatever -- becomes safe, printable text.

Where You'll Actually Run Into Base64

Email was the original use case -- MIME encoding relies on Base64 to turn attachments into text that can travel through email servers. Web developers use it to embed small images directly in CSS or HTML via data URIs, saving an extra HTTP request. If you've ever set up API authentication with Basic Auth, you were Base64-encoding your username and password. It also shows up whenever you need to stuff binary data into JSON, XML, or any other text-only format.

Base64 vs. Other Encoding Options

Base64's 33% size increase is the price you pay for near-universal support. Base32 bumps that overhead to 60% but doesn't care about uppercase vs. lowercase, which helps in some edge cases. Hex encoding doubles your data size but is dead simple to read when debugging. There's also URL-safe Base64, which swaps out + and / for - and _ so your encoded data doesn't break URLs. Pick the right one based on where the data is going and how much size matters.

Domande frequenti

What is Base64 encoding?

A method to encode binary data as ASCII text using 64 characters.

Why use Base64?

To safely transmit binary data in text-based formats like email, JSON, and HTML.

Does Base64 increase file size?

Yes, approximately 33% larger than the original.

Strumenti correlati