Base64 Encode / Decode
Encode text or decode Base64 strings instantly
What is Base64?
Base64 is a group of binary-to-text encoding schemes that represent binary data in an ASCII string format. The name refers to the 64-character alphabet used: A-Z (26 characters), a-z (26 characters), 0-9 (10 characters), and two additional symbols (+ and /, or - and _ in the URL-safe variant).
Base64 was originally developed for MIME (email) to allow binary attachments to be transmitted over text-only protocols. Today it's used across virtually every layer of web development.
How Base64 encoding works
Base64 takes every 3 bytes (24 bits) of input and converts them into 4 Base64 characters (each representing 6 bits). This is why the output is always about 33% larger than the input.
For example, the text "Otto" encodes to T3R0bw==. The two = signs are padding because "Otto" is 4 bytes, not a multiple of 3.
How to use the Base64 tool
To encode: select "Encode โ" mode, paste your plain text into the left input, and the Base64 output appears immediately on the right.
To decode: select "โ Decode" mode, paste your Base64 string into the left input, and the decoded text appears on the right. If the Base64 string is invalid, you'll see an error message.
Swap: use the Swap button to quickly reverse the operation โ the output becomes the new input and the mode switches automatically.
Common Base64 use cases
Data URIs โ embedding small images directly in HTML or CSS without a separate HTTP request. A small icon might look like <img src="data:image/png;base64,iVBOR...">. This saves an HTTP round-trip for small assets.
JSON API responses โ when an API needs to return binary data (like a generated PDF or image) in a JSON response, Base64 encoding is the standard approach since JSON only handles text.
JWT tokens โ the three parts of a JWT (header, payload, signature) are all Base64url-encoded. Our JWT decoder handles the decoding, but understanding Base64 helps you understand how JWTs work.
Basic authentication โ HTTP Basic Auth sends credentials as username:password encoded in Base64 in the Authorization header. Note that this provides no security on its own โ always use HTTPS.
Email attachments โ the original use case. MIME email standards use Base64 to encode binary attachments so they can be transmitted over text-only email protocols.
Storing binary data in databases โ when you need to store a binary value (like a hash or binary ID) in a text field in a database, Base64 encoding is a common approach.