FREE WEB TOOL

Encode or Decode HTML Entities

Encode special HTML characters or restore entity references.

Enter text or entities

How to use it

Encode the HTML-sensitive characters &, <, >, " and ' as entity references, or decode entity references back to ordinary text. This is useful when you want HTML code to appear as text instead of being interpreted as markup.

  1. Paste the text you want to convert.
  2. Choose Encode to create entity references, or Decode to restore characters.
  3. Check the result and copy it if needed.
Main characters
& < > " '
Example
<div> → &lt;div&gt;
Decode
Browser-native named and numeric entity parsing
Processing
In browser

Showing HTML as text

If you want <div class="sample">A & B</div> to appear inside documentation or an article, encoding the angle brackets and ampersand prevents those characters from being treated as normal markup delimiters.

This is an entity conversion tool, not an HTML sanitizer. It does not decide whether arbitrary markup is safe to execute.

Why the less-than sign needs special handling

In HTML, < normally starts a tag. Writing it as &lt; tells the browser that the character itself should be displayed rather than interpreted as markup.

Ampersand is special too

& begins an entity reference, so literal ampersands are commonly written as &amp; when they appear in HTML text. It is easy to miss in code examples and query-string samples.

Named and numeric entity references can be restored

The decoder can turn common named references such as &lt; and numeric references back into ordinary characters. The result is shown as text rather than executed as HTML.

Encoding is not the same as sanitizing

Escaping text for one HTML context does not automatically make data safe everywhere. Attributes, URLs and JavaScript contexts have different validation and encoding requirements.