
Base64 is a fundamental encoding scheme used universally across the web.
What is Base64?
Base64 represents binary data in an ASCII string format. It translates data into a radix-64 representation, using only letters, numbers, '+', and '/'.
Why do we use it?
Systems like email (SMTP) or HTML/CSS originally only safely supported text. If you wanted to embed an image or send a binary file, it would get corrupted. Base64 safely packages binary data into plain text.
Common Use Cases
1. Data URIs: Embedding small images directly in CSS to save network requests. 2. JWT Tokens: JSON Web Tokens use Base64 to safely transmit authorization claims in HTTP headers. 3. Basic Auth: HTTP Basic Authentication encodes credentials in Base64.
Base64 increases file size by ~33%, so it's best for small files or text protocols!