Code drawer

HTML entity encoder

Move text in and out of markup without breaking the page.

Privacy built inYour work stays with you

Result

Enter text to convert.

Decoded output is shown as text and is never inserted into the page as markup.

Your work stays private in your browser while you use this tool.

In short

What does html entity encoder do?

The HTML entity encoder escapes the five characters that change meaning inside markup — & < > " and ' — so text can be placed in a page safely, and decodes named, decimal, and hexadecimal entity references back to the characters they stand for. Decoded output is shown as text and is never inserted into the page as markup.

Input
Plain text to escape, or text containing entity references.
Result
Escaped markup or the decoded characters, as text.
Price
Free
Account
Not required
A quick, useful guide

How to use html entity encoder

01

Add your input

Plain text to escape, or text containing entity references.

02

Choose your settings

Move text in and out of markup without breaking the page.

03

Save or copy

Escaped markup or the decoded characters, as text.

A practical tip

Decoded output is shown as text and never inserted into the page as markup.

Practical uses

When to use html entity encoder

Escape a code sample so angle brackets display instead of being parsed as tags.

Read what an entity-encoded string from a feed or export actually says.

Check whether a value has been double-encoded before it reaches a template.

Worked example

A concrete html entity encoder example

Input
Decode &lt;b&gt;hi&lt;/b&gt; &amp; &copy; &#8364;
Result
<b>hi</b> & © €, returned as plain text rather than rendered markup.
What to expect

How it works

Encoding walks the input character by character, replacing markup-significant characters with their named references; the optional wider scope also converts every non-ASCII character to a numeric reference. Decoding runs a single pass, so &amp;lt; becomes &lt; rather than <, which keeps the operation reversible. Named references resolve from an explicit table, numeric ones are parsed in decimal or hexadecimal, and anything unrecognised is left exactly as written.

Know before using

Limits and edge cases

  • Only a curated set of named references is decoded. The full HTML5 table has more than two thousand entries, and unknown names are returned verbatim rather than guessed at.
  • Code points above U+10FFFF or inside the surrogate range decode to the replacement character, because no valid character exists for them.
References

Standards and sources

Common questions

HTML entity encoder FAQ

Is html entity encoder free to use?

Yes. HTML entity encoder is free to use.

Does html entity encoder keep my work private?

Yes. Your work stays private while you use the tool — nothing you enter is uploaded.

Can decoding an entity-encoded script tag run the script?

No. The decoded value is returned as a string and rendered as text content, never assigned as markup, so a decoded script tag is displayed rather than executed.

Why did &amp;lt; decode to &lt; instead of <?

Decoding is deliberately a single pass. &amp;lt; is the encoded form of the text &lt;, so one pass returns that text. Running a second pass would make the operation lossy and unable to represent a literal entity reference.