Skip to content
DevTrove

Encoding

HTML Encode / Decode

Escape the HTML special characters & < > " ' as entities, or decode HTML entities back into text.

Runs in your browser

How to use

  1. Paste or type text into the input box.
  2. Select Encode to escape HTML special characters, or Decode to turn HTML entities back into characters.
  3. Use Copy output to copy the result.

What gets encoded

Encoding escapes exactly the five characters that have special meaning in HTML: & becomes &amp;, < becomes &lt;, > becomes &gt;, " becomes &quot; and ' becomes &#39;. The result is safe to place in HTML text and in quoted attribute values.

Everything else — letters in any language, emoji, spaces and line breaks — is kept as is, because a UTF-8 page can contain these characters directly. Text that already contains entities is encoded again: &lt; becomes &amp;lt;.

What gets decoded

Decoding converts numeric references such as &#60; and &#x3C; for any Unicode character, and the named references &amp; &lt; &gt; &quot; and &apos; (plus their uppercase forms &AMP; &LT; &GT; &QUOT;). A reference must end with a semicolon. Decoding is done once, so &amp;lt; becomes &lt;.

Other named entities such as &nbsp; or &copy;, numbers that are not valid Unicode characters, and references without a semicolon are kept exactly as written, and the tool tells you how many were left unchanged. Nothing is guessed.

Always plain text

The output is shown as plain text and is never rendered or run as HTML, so decoding <script> tags is safe. This tool escapes characters; it is not an HTML sanitizer and does not make untrusted HTML safe to render.

Input is limited to 5,000,000 characters, and encoded output to 20,000,000 characters.

FAQ

Is my text uploaded?
No. Encoding and decoding run entirely in your browser. Your text is not sent to a server, not stored, and not added to the page URL.
Why is ' encoded as &#39; and not &apos;?
&#39; works in every version of HTML and XHTML, while &apos; is not defined in HTML 4. Both are decoded.
Does encoding then decoding give back my original text?
Yes. Decoding the encoded output always returns the original text. The reverse is not always identical: &#60; decodes to <, which encodes as &lt;.