Encoders & Decoders

Base64 turns binary data into plain ASCII text so it can pass through systems that only handle text: JSON payloads, email bodies, HTML attributes, HTTP headers and environment variables. You run into it when you inline a small icon into CSS, read a JWT, inspect an email attachment, or store a file in a database column that only accepts strings.

These tools cover the common cases. Encode text to Base64, decode a Base64 string back to readable text, turn an image file into a data URI for an img tag or a CSS background, and convert a Base64 string back into an image you can view and download. The image tools show the resulting size. Check that number before you inline an image: Base64 adds roughly 33%, so a 30 KB PNG becomes about 40 KB of text.

HTML entities solve a related problem with a different alphabet. The encoder escapes <, > and & so a stray bracket renders as a character instead of opening a tag. The decoder turns a page full of &amp;amp; and &amp;#8217; back into readable punctuation, which covers most of what you need after a CMS export or a scrape.

Everything runs on the browser's built-in APIs, so files stay on your machine. That matters when the image is a customer document or the text is a credential.

Which tool for which job

  • Encode text or a file for a JSON field, a header or an environment variable

    Base64 Encoder. Text is encoded as UTF-8 first, so accented letters and emoji work. Plain btoa() throws an error on them.

  • Read a Base64 value from a Kubernetes secret or an email source

    Base64 Decoder. The bytes are decoded as UTF-8, so text in any language comes back intact.

  • Inline a small icon in CSS or HTML

    Image to Base64. You get the whole data URI, MIME type prefix included, ready for src or url().

  • See which image a data URI contains

    Base64 to Image. Paste the string with or without the data: prefix, check the preview and download it as a file.

  • Show code or user input on a page without the browser running it

    HTML Encoder. Escaping <, > and & turns markup into visible text. Choose named, decimal or hex entities to match the rest of the file.

  • Clean &amp; and &#8217; out of exported text

    HTML Decoder. Entities from a CMS export or a scraped page turn back into the plain characters they stand for.

  • Put a multi-line string or a block of HTML into a JSON value

    JSON Escape / Unescape. Quotes, backslashes and line breaks are escaped so the result can sit between double quotes in a JSON file.

  • Paste a Windows path or a regex into a string literal

    String Escape / Unescape (Backslash). Pick the target language first. JavaScript, Python, PHP, Bash, SQL and regex each escape a different set of characters.

  • Read bytes from a hex dump or a packet capture

    Hex to Text Converter. The bytes are decoded as UTF-8, and the tool can also encode text back to hex.

  • See how many bytes a character takes

    Text to Binary Converter. In UTF-8, é is two bytes and most emoji are four, which matters when a field or a protocol limits length in bytes.

Other tool categories

Specifications and references

This tool follows the specifications below. Read them when you need the exact normative wording, for example to settle an edge case between two implementations.

Frequently Asked Questions

Is Base64 a form of encryption?

No. Base64 uses no key, so anyone who has the string can decode it in one step. It exists to carry binary data through channels that only accept text. If a value has to stay secret, encrypt it first, then Base64-encode the ciphertext if you need it as text.

What is the difference between Base64 and URL encoding?

Base64 rewrites any bytes using an alphabet of 64 safe characters, and the result is about a third longer than the input. URL encoding leaves letters and digits alone and replaces only the characters that would break a URL, such as a space with %20. Standard Base64 uses + and /, which mean something in a URL, so tokens and JWTs use the base64url variant with - and _ in their place.

Why does decoded text show é instead of é?

The bytes are UTF-8, but something read them as Latin-1 or Windows-1252. In UTF-8, é is the two bytes C3 A9, and in Latin-1 those bytes are the characters à and ©. Decode as UTF-8, or find the step in your pipeline that assumed a single-byte encoding.

Copied to clipboard!