Encode text or files to Base64, or decode Base64 strings back to plain text instantly.
Converts file to Base64 data URI — useful for embedding images in HTML/CSS
Base64 is an encoding scheme that converts binary data into a text string using 64 characters. It is commonly used to embed images directly into HTML or CSS files, transmit binary data through text-based systems like email, and encode API authentication credentials.
Base64 shows up wherever binary data has to travel through a text-only channel. Email attachments are encoded as Base64 inside the MIME message because raw binary can break older mail transfer protocols. Data URIs (data:image/png;base64,...) let you embed a small icon or logo directly inside HTML or CSS so the browser doesn't need a separate network request. JSON Web Tokens (JWTs) use Base64URL — a URL-safe variant — to encode their header and payload segments so they can be passed safely in a URL or HTTP header. It's worth remembering that Base64 is an encoding, not encryption: anyone can decode it back to the original text in one step, so it should never be used to hide sensitive data on its own.
This tool runs entirely in your browser using the built-in btoa()/atob() JavaScript functions — nothing you type or upload is sent to a server, which makes it safe to use for API keys, tokens, or other private strings you'd rather not paste into a random website.
A Base64 encoder converts text or binary data (like an image or PDF) into a plain ASCII text string using 64 safe characters (A–Z, a–z, 0–9, + and /). It's the standard way to pass binary data through systems built for text — email attachments, data URIs embedded in HTML/CSS, and the header/payload segments of JWTs (JSON Web Tokens) all rely on Base64 encoding under the hood.
Decoding reverses the process exactly — there's no information loss and no key required, which is the key distinction from encryption. This tool handles both directions for plain text and, via the file upload, produces a ready-to-use Base64 data URI for any file type directly from your browser.
| Base64 | Hex | URL Encoding | |
|---|---|---|---|
| Size overhead | ~33% larger | 100% larger (2 chars per byte) | Varies (0–200%, depends on content) |
| Common use | Email, data URIs, JWTs, API tokens | Cryptographic hashes, colour codes, debugging | Query strings and form data in URLs |
| URL-safe by default | No (+ and / need replacing) | Yes | Yes, by design |
| Who | Common Use |
|---|---|
| 🧑💻 Web developers | Embed small images or icons directly into HTML/CSS as data URIs |
| 🔐 API developers | Encode credentials for Basic Auth headers or decode JWT payloads |
| 📧 Email/template developers | Encode images for inline embedding in HTML email templates |
| 🎓 Students & learners | See exactly how text-to-Base64 conversion works, byte by byte |
| 🛠️ Support & QA | Decode Base64 strings found in logs, tokens, or API responses to check their contents |
Is Base64 the same as encryption?
No. Base64 is a reversible encoding, not encryption — anyone with the encoded string can decode it back to the original text instantly, with no password or key required. Use proper encryption (like AES) if you need to keep data confidential.
Why does the encoded output look longer than my input?
Base64 represents every 3 bytes of input as 4 output characters, so encoded data is roughly 33% larger than the original. This is expected and not an error.
Can I encode an entire file, not just text?
Yes — use the "Encode File to Base64" section above. It converts any file (image, PDF, font, etc.) into a Base64 data URI you can paste directly into HTML, CSS, or an API request.
Why do I get an error when decoding?
Decoding fails if the input isn't valid Base64 — for example, if it contains spaces, line breaks, or characters outside the standard A–Z, a–z, 0–9, +, / and = alphabet. Make sure you've copied the full, unmodified encoded string.
Is anything I encode or decode sent to a server?
No. All encoding and decoding happens locally in your browser using standard JavaScript functions. Nothing is uploaded, logged, or stored — you can even disconnect from the internet after the page loads and it will keep working.
How do I convert an image to a Base64 data URI?
Use the "Encode File to Base64" upload zone and select the image. The tool reads it as a Base64 data URI (e.g. data:image/png;base64,...) that you can paste straight into an HTML src attribute or a CSS background-image, with no external file request needed.
What's the difference between Base64 and hex encoding?
Both represent binary data as text, but Base64 packs 3 bytes into 4 characters (about 33% overhead) while hex encoding represents each byte as 2 characters (100% overhead). Base64 is more compact and is the standard for email, data URIs, and JWTs; hex is more common in cryptography, colour codes, and low-level debugging where readability of individual bytes matters more than size.
Can I use this as a Base64 URL encoder?
This tool produces standard Base64, which uses + and / characters that aren't safe to place directly in a URL. If you need URL-safe Base64 (used in JWTs), replace + with -, / with _, and drop any trailing = padding after encoding here.