Base64 Encoder / Decoder
Your data never leaves your browserEncode text to Base64 or decode Base64 back to text. Supports standard and URL-safe variants. Runs 100% in your browser.
Share this tool
Found it useful? Help a fellow developer discover it.
What is Base64?
Base64 is an encoding scheme that converts binary data into a sequence of printable ASCII characters using an alphabet of 64 symbols (A–Z, a–z, 0–9, +, /). Every 3 bytes of input becomes 4 Base64 characters. This makes the output approximately 33% larger than the original. It is widely used to safely transmit binary data over text-based protocols. It lets you embed images in HTML or CSS using data URIs. It encodes email attachments for MIME. It carries binary payloads inside JSON. It also stores credentials in HTTP Basic Authentication headers. The URL-safe variant replaces + with - and / with _. This makes it safe for use in URLs and filenames without percent-encoding.
How to use the Base64 Encoder / Decoder
- Select Encode or Decode mode using the toggle in the options bar.
- Paste or type your input into the left panel.
- The output appears instantly in the right panel. Press Ctrl+Enter to re-run manually.
- Use the Variant selector to switch between Standard Base64 (for MIME, HTTP headers) and URL-safe Base64 (for URLs, JWT tokens, filenames).
- Click Swap ⇄ to move the output into the input panel, which is useful for quickly reversing the operation.
Common Base64 use cases
- HTTP Basic Authentication. Credentials are sent as
Authorization: Basic base64(username:password)in request headers. The encoding is not encryption, it is just a way to safely include the colon-delimited credentials as a single header value. - Data URIs in HTML and CSS. Inline images, fonts, and other assets using
data:image/png;base64,...to eliminate extra HTTP requests. Useful for small icons and critical above-the-fold images. - JWT token payloads. The header and payload sections of a JWT are URL-safe Base64 encoded. Decode the middle segment of any JWT to inspect its claims without a signature key.
- Binary data in JSON. JSON cannot represent raw binary natively, so file contents, images, and cryptographic keys are Base64 encoded before embedding in JSON API payloads.
- Email attachments (MIME). SMTP transfers text only, so email clients encode file attachments as Base64 before transmission and decode them on receipt.
Frequently Asked Questions
How do I decode a Base64 string to plain text?
Select Decode mode using the toggle in the options bar, then paste the Base64 string into the input panel. The decoded text appears instantly in the output. Whitespace and line breaks within the Base64 string are stripped automatically before decoding, so you can paste multi-line encoded strings directly.
What is a Base64 data URI and how do I use one?
A data URI embeds file content directly in HTML or CSS using the format data:[mediatype];base64,[data]. For example, data:image/png;base64,iVBORw0K... embeds a PNG image inline, eliminating an HTTP request. Use the Image to Base64 tool to generate data URIs from image files. This tool handles text-based encoding for string payloads.
Is my data kept private when using this tool?
Yes. All encoding and decoding happens entirely in your browser using the native btoa() and atob() Web APIs. Your input is never sent to any server.
What is the difference between standard and URL-safe Base64?
Standard Base64 uses + and / in its alphabet and pads output with = characters. These characters have special meaning in URLs, so URL-safe Base64 replaces + with - and / with _ and omits the = padding. URL-safe Base64 is used in JWT tokens, OAuth, and anywhere Base64 appears inside a URL or filename.
Why does Base64 make the output larger?
Base64 encodes every 3 bytes of input as 4 ASCII characters. This 4/3 ratio means the output is always about 33% larger than the input. This size cost is the tradeoff for making binary data safe to transmit over text-only channels.
Can I encode images or binary files with this tool?
This tool encodes and decodes text (UTF-8 strings). For binary files like images, use the Image to Base64 tool which reads raw bytes via the FileReader API. Base64 data URIs for images are binary-encoded, not text-encoded.
Why do I get an error when trying to decode some Base64 strings?
Two common causes: (1) The string contains invalid Base64 characters. Base64 only uses A-Z, a-z, 0-9, +, /, and = for padding. (2) The decoded bytes are not valid UTF-8. This happens when the original input was binary data such as an image or compressed file rather than a text string.
Is Base64 a form of encryption?
No. Base64 is an encoding scheme, not encryption. It is trivially reversible by anyone without any key or secret. Never use Base64 to hide sensitive data. Use proper encryption such as AES or RSA for that purpose.
Related Tools
URL Encoder / Decoder
Encode or decode URL components and query strings.
Image to Base64
Convert PNG, JPG, GIF, WebP, SVG, and BMP to Base64. Output as raw string, CSS background-image, or HTML <img> tag. Drag & drop.
Unicode Lookup
Look up Unicode code points, HTML entities, hex values, and UTF-8 bytes for any character or text. Supports emoji.
Binary to Text Translator
Translate binary code to text and text to binary. Reads UTF-8, 7-bit ASCII, hex and decimal bytes, with a per-character breakdown. Runs in your browser.
From the Blog
Why Your Emails Sometimes Look Like Garbled Nonsense. The History of Base64 and Why It Is Everywhere in Web Development
Traces Base64 from its 1982 email origins to its modern role in JWTs, HTTP Basic Auth, and data URIs. Essential reading for developers who use it daily.
Read article