Base64 encoder / decoder
Encode any text or binary data to Base64, or decode Base64 strings back to plain text. Nothing is sent to a server — all processing happens locally.
What is Base64 encoding?
Base64 is a binary-to-text encoding scheme that represents binary data as an ASCII string. It's commonly used to embed images in HTML/CSS (data URIs), encode data in URLs, transmit binary content through text-only channels like email (MIME), and store binary data in JSON or XML where binary isn't supported. Each 3 bytes of input map to 4 ASCII characters, which is why Base64 is always about 33% larger than the original.
When to use Base64
Inline small images in CSS or HTML to reduce HTTP requests (at the cost of caching granularity). Encode binary attachments in JSON APIs where the protocol only allows text. Encode special characters in URL parameters when combined with URL encoding. Store binary data in text-only databases, logs, or config files.
Base64 vs URL encoding
These serve different purposes. Base64 converts arbitrary binary into ASCII. URL encoding (percent-encoding) escapes characters that aren't valid in a URL. They're not interchangeable, though Base64-then-URL-encode is a common pattern when embedding binary in links. For URL-safe encoding, use our URL encoder / decoder.
Common Uses
- Embedding images in HTML/CSS: Convert images to Base64 data URIs to inline them directly in HTML or CSS, eliminating a separate HTTP request.
- Debugging JWT tokens: JWT headers and payloads are Base64URL-encoded — decode them to inspect claims without a dedicated JWT debugger.
- Email attachment encoding: MIME-compliant email systems require binary attachments to be Base64-encoded; verify encoded output before sending.
- API request/response inspection: Some REST APIs encode binary blobs, images, or cryptographic keys in Base64 — decode to inspect the raw content.
- Storing binary data in JSON: JSON cannot natively represent binary; Base64 is the standard way to embed file contents or byte arrays in a JSON payload.
- Environment variable encoding: Secret keys and certificates are often Base64-encoded in .env files and CI/CD pipelines for safe storage and transmission.
- Web font embedding: Custom web fonts can be Base64-encoded and embedded directly in CSS files to avoid CORS issues in restricted environments.
FAQ
Is Base64 encryption?
No. Base64 is encoding, not encryption. Anyone can decode Base64 with no key or password. Never use it to protect sensitive data — treat Base64-encoded content as plain text.
Why does Base64 make data larger?
Each 3 bytes of input become 4 characters of output (6 bits per character instead of 8). That's a ~33% size overhead. Padding with "=" characters at the end accounts for a small additional overhead when the input length isn't a multiple of 3.
Does Base64 support Unicode?
Yes. This tool encodes text as UTF-8 before Base64-encoding it, so characters like ñ, ü, and 日本語 work correctly. Decoding reverses this by first Base64-decoding, then parsing the bytes as UTF-8.
Does this tool send my data anywhere?
No. All encoding and decoding runs entirely in your browser using JavaScript. Your data never leaves your device.
Does Base64 encoding encrypt my data?
No. Base64 is an encoding scheme, not encryption. Encoded strings are trivially reversible by anyone. Never use Base64 to protect sensitive data.
By the Numbers
- Base64 encoding increases data size by approximately 33% over the original binary input
- The Base64 alphabet and encoding rules are defined in RFC 4648 (2006), the authoritative IETF standard
- Base64 is used by virtually every email system worldwide via MIME to safely encode binary attachments
- JSON Web Tokens (JWT) use Base64URL — a URL-safe variant replacing
+and/with-and_