What Is Base64?
Base64 is a binary-to-text encoding scheme that converts binary data into a string of 64 printable ASCII characters. The name comes from the 64 characters used: A-Z, a-z, 0-9, +, and / (with = as a padding character).
Base64 was originally designed to safely transmit binary data β like images or file attachments β over protocols that only handle text, such as SMTP (email) and HTTP headers.
Why Is Base64 Needed?
Many communication protocols were designed to transport only ASCII text. When you need to embed binary data (like an image or a PDF) in a text-based format (like JSON, XML, or an email), you need a way to represent the binary as safe ASCII characters. That's exactly what Base64 does.
Common use cases:
1. Email attachments (MIME encoding): Email uses Base64 to encode binary attachments.
2. Data URLs in HTML/CSS: Inline images in HTML use data:image/png;base64,... syntax.
3. JWT tokens: JSON Web Tokens use Base64URL encoding for their header and payload sections.
4. API payloads: Some REST APIs transmit binary files as Base64 strings in JSON bodies.
5. Basic HTTP authentication: Credentials are Base64-encoded in the Authorization: Basic ... header.
Base64 Is Not Encryption
This is critical: Base64 is encoding, not encryption. Anyone can trivially decode a Base64 string β it's just a reversible representation change. Do not use Base64 to "hide" sensitive information.
`
// This is NOT secret β anyone can decode it
SGVsbG8gV29ybGQ= β "Hello World"
`
How to Encode and Decode Base64 Online
FuaHub's Base64 Encoder/Decoder works entirely in your browser:
1. Open the [Base64 Tool](/tools/dev/base64).
2. Paste your text in the input area.
3. Click Encode to get the Base64 string, or paste a Base64 string and click Decode.
4. Copy the result with one click.
Base64 Encoding Size Overhead
Base64-encoded data is approximately 33% larger than the original binary. Every 3 bytes of input become 4 Base64 characters. This overhead is important to consider when embedding large images as Data URLs β it increases payload size significantly compared to referencing the image via URL.
Base64URL vs Standard Base64
Base64URL is a variant that replaces + with - and / with _, making it safe to use in URLs and filenames without percent-encoding. JWT tokens use Base64URL encoding.