How it works
Base64 is a binary-to-text encoding scheme that represents binary data using 64 printable ASCII characters. The Base64 Encoder Decoder converts plain text or binary content to its Base64 representation, and decodes Base64 strings back to the original content.
Base64 is ubiquitous in software. Email attachments are transmitted as Base64-encoded MIME parts. JSON Web Tokens (JWTs) use Base64url (a URL-safe variant) for their header and payload. HTML data URIs embed images as Base64 strings. CSS background images can be inlined as Base64. API authentication credentials are often transmitted as Base64-encoded "username:password" strings.
How to use it: paste your text or Base64 string, then click Encode or Decode. The tool outputs the result instantly. For Base64url (used in JWTs and URL-safe contexts), toggle the URL-safe mode which substitutes + with - and / with _.
Encoding explanation: the encoder groups the input into 3-byte blocks and maps each block to 4 Base64 characters. If the input length isn't divisible by 3, padding characters (=) are appended to make the output length divisible by 4. This means Base64-encoded data is approximately 33% larger than the original binary.
Decoding: the decoder reverses this mapping. Invalid Base64 characters in the input are flagged, and the tool shows an error rather than silently producing garbled output.
Privacy matters here: Base64 strings often contain JWTs, which carry authentication claims and user identity data. Processing them locally means your tokens are never transmitted to a third-party service. Similarly, data URIs containing embedded file content remain entirely on your device.
Frequently Asked Questions
- Base64 is used wherever binary data needs to travel through text-only channels: email attachments (MIME), JSON Web Tokens (JWTs), HTML data URIs, HTTP Basic Auth headers, and embedding binary files in text formats.
- Standard Base64 uses + and / characters, which are special characters in URLs. Base64url substitutes these with - and _ respectively, making the output safe for URL path and query string use. JWTs use Base64url.
- Base64 represents every 3 bytes of input as 4 characters of output (a 4/3 ratio). A 1,000-byte file becomes ~1,333 Base64 characters. This overhead is the trade-off for text-safe binary representation.
- This tool handles text encoding/decoding. For encoding binary files (images, PDFs) to Base64, use the Base64 File Encoder tool which accepts file uploads and converts binary file content to Base64.