GenerateRandomSearch

Text Encoder and Decoder

Base64, percent-encoding and HTML escaping all exist because some channel cannot carry arbitrary bytes, and all three go wrong in the same place: the characters outside plain ASCII. A tool that handles "hello" and mangles "café" or an emoji is worse than useless, because the failure only shows up on the data that mattered. Base64, percent-encoding, hex and binary here work on UTF-8 bytes rather than characters, HTML escaping replaces only the five characters that mean something to a browser, and each decodes its own output to prove it.

What this generator does

Turns your text into UTF-8 bytes and encodes those — or, for HTML escaping, swaps the five reserved characters and leaves the rest alone — so the result survives whatever characters the text contains, then decodes its own output and compares.

How to use this tool

  1. Paste your text and choose an encoding.
  2. Encode it, and copy the result.
  3. Paste encoded text into the second box to read it back.
  4. The byte count is given alongside the character count, since they differ.

Understanding the controls

Your text
Up to a hundred thousand characters. Accents, symbols and emoji are all fine, and the byte count will differ from the character count where they appear.
Encoding
Base64, the URL-safe variant of Base64, percent-encoding for URLs, HTML entities, hexadecimal bytes or binary bytes.

Worked examples

An accented word in Base64
"café" is 5 bytes in UTF-8 (the é takes two), so it becomes Y2Fmw6k= — a 4-character word encoding to 8 Base64 characters, not the 4 you'd expect if you counted letters instead of bytes.

Common use cases

  • Encoding a value for a URL or a query string
  • Reading a Base64 string somebody has sent you
  • Escaping text so it can go safely into HTML
  • Seeing the bytes behind a piece of text
  • Checking that an accented name survives an encoding

How this generator works

Every encoding decodes its own output and the result must equal the text that went in, character for character. Where the text uses characters beyond plain ASCII, that is called out separately, because those are the ones an encoding actually breaks on. Base64 output is checked against the alphabet its form allows, and HTML output is checked to leave no bracket raw.

Randomness and fairness

Nothing is random. The same text always encodes the same way.

For how randomness is produced across the whole site, see how Generate Random works.

Limitations and good to know

  • Text in, text out. Encoding a file or an image is a different job.
  • The URL-safe Base64 drops its padding, which is the usual convention but not universal — some readers insist on it.
  • HTML escaping covers the five characters that matter for markup, not every possible named entity.
  • Percent-encoding follows the rules for a single URL component, which escapes more than encoding a whole URL would.

Privacy and your data

Everything is encoded in your browser. Nothing you paste is transmitted or stored.

Frequently asked questions

Why does my accented or emoji text produce a longer encoded result than expected?
Because encoding here works on UTF-8 bytes, not characters — and most characters beyond plain ASCII take more than one byte. An accented letter like é is 2 bytes, and most emoji are 4, so the byte count (and everything derived from it, like Base64 length) is always at least as large as the character count and often several times larger.
Which encoding should I use for a URL query parameter?
Percent-encoding, not Base64 — a URL can contain letters and digits directly but needs symbols and non-ASCII characters escaped as %XX sequences. Base64 is for contexts that need arbitrary bytes represented in a small safe alphabet, such as embedding binary data in JSON or a header, not for putting text in a URL.