Base64 Encoder
Convert text or data to Base64 encoding instantly. Runs entirely in your browser — nothing is sent to a server.
What is Base64 Encoding?
Base64 encoding converts binary data or arbitrary text into a string made up of 64 printable ASCII characters: uppercase A–Z, lowercase a–z, digits 0–9, plus sign (+), and forward slash (/), with equals signs (=) used as padding. The name comes directly from the 64-character alphabet. Because the output uses only safe, printable characters, Base64-encoded data can travel through any system that handles text — email, JSON, XML, HTTP headers — without corruption.
Base64 is not encryption. Anyone who receives a Base64 string can decode it instantly. It exists purely to solve a compatibility problem: binary data contains byte values (0–255) that many text-based protocols interpret as control characters or delimiters. Base64 sidesteps this by representing every 3 bytes of input as 4 printable output characters, expanding size by roughly 33%.
How Base64 encoding works
The encoder takes each group of 3 bytes (24 bits) and splits them into four 6-bit values. Each 6-bit value (0–63) maps to one character in the Base64 alphabet. If the input length is not a multiple of 3, the encoder pads the input with zero bytes and appends one or two = characters to signal the padding. For example, the word Man encodes to TWFu; the single character M encodes to TQ== (two padding characters).
Common use cases
- Data URIs — embed images, fonts, or other binary files directly in CSS or HTML:
src="data:image/png;base64,iVBOR...". Eliminates extra HTTP requests for small assets. - Email attachments (MIME) — SMTP was designed for 7-bit ASCII. Base64 is the standard transfer encoding for attaching files to emails.
- JWT tokens — JSON Web Tokens encode their header and payload as Base64url (a URL-safe variant using
-and_instead of+and/). - API payloads — pass binary file content (images, PDFs, certificates) through REST or GraphQL APIs that accept JSON strings.
- Cryptographic keys and certificates — PEM files (TLS certificates, SSH keys) use Base64 to encode binary DER data between
-----BEGIN-----headers. - Browser storage — store binary blobs in localStorage or IndexedDB, which only accept strings.
Base64 vs Base64url
Standard Base64 uses + and /, which are reserved characters in URLs. Base64url (defined in RFC 4648) replaces them with - and _, making the output safe to use directly in URL path segments and query strings without percent-encoding. JWTs always use Base64url. This encoder produces standard Base64; if you need Base64url output, replace + with -, / with _, and strip trailing = padding.
Frequently asked questions
Is Base64 encoding secure?
No. Base64 provides zero confidentiality — it is trivially reversible. Never use it as a substitute for encryption. If you need to protect data, use AES encryption or TLS. Base64 is only for encoding, not security.
Does Base64 encoding increase file size?
Yes, by approximately 33%. Every 3 bytes of input produce 4 bytes of output. For large files, this overhead matters — avoid Base64-encoding large images inline if network performance is a concern.
Can Base64 encode any type of data?
Yes. Base64 works on raw bytes, so it can encode any binary data: images, PDFs, archives, executables, or arbitrary text in any language.
If jsondecode.com saved you time, share it with your team
Free forever. No ads. No sign-up. Help other developers find it.