What is Base64 and Why Is It Used?
Base64 encodes binary data as ASCII text. This is essential because many protocols (HTTP, SMTP, JSON) were designed for text and can corrupt binary data. By converting binary to Base64 text, it can be safely transmitted through any text-based protocol.
Common examples: JWT (JSON Web Tokens) use Base64URL encoding. Data URIs in HTML embed images as Base64. HTTP Basic Auth sends credentials as Base64. MIME email attachments use Base64 for file encoding.