1. Home
  2. Tools
  3. HTML encoder / decoder

Free · no sign-up · runs in your browser

HTML Encoder & Decoder

Escape HTML so it shows as code on a web page (<p> → &lt;p&gt;), or decode entities like &amp; and &#39; back to normal characters.

Input
Result

In shortEncoding turns special characters into HTML entities (< becomes &lt;, & becomes &amp;) so code displays as text instead of running; decoding does the reverse. Paste text and click Encode or Decode.

How to use the HTML encoder / decoder

  1. Paste text. Paste the HTML or text you want to convert.
  2. Pick Encode or Decode. Encode escapes special characters; Decode turns entities back into characters.
  3. Adjust options. Encode all non-ASCII characters, use numeric entities, or convert new lines to &lt;br&gt;.
  4. Copy the result. Copy it, download it, or swap it back into the input.

When do you need to encode HTML?

Browsers treat < as the start of a tag and & as the start of an entity. To show HTML code on a page — in a tutorial, a blog post or a documentation site — those characters must be written as entities, otherwise the browser runs the code instead of displaying it. Encoding user input before inserting it into a page is also the basic defence against cross-site scripting (XSS).

The five characters that matter

CharacterEntityWhy
&&amp;Starts every entity
<&lt;Starts a tag
>&gt;Ends a tag
"&quot;Ends a double-quoted attribute
'&#39;Ends a single-quoted attribute

Every other character (é, €, emoji) can be typed directly as long as the page declares <meta charset="utf-8">. Tick Encode all non-ASCII characters only for systems that can't handle UTF-8. For a searchable list see the HTML character codes reference.

Decoding

Decoding turns &lt;p&gt; back into <p> and handles every named entity (&eacute;), decimal (&#233;) and hex (&#xE9;) form — useful for reading escaped HTML from JSON, databases, RSS feeds and email sources.

Private by design: this tool runs entirely in your browser. Nothing you paste or open is uploaded to a server.

Frequently asked questions

What is HTML encoding?

Replacing characters that have special meaning in HTML (< > & " ') with entities like &lt; so they display as text instead of being interpreted as markup.

How do I show HTML code on a web page?

Encode it here, then paste the result inside <pre><code> … </code></pre>. The browser will display the tags instead of rendering them.

What's the difference between &amp;amp; and &amp;#38;?

Nothing visible — both produce &. The first is a named entity, the second numeric. Numeric entities work for every Unicode character.

Is HTML encoding the same as URL encoding?

No. URL encoding uses % codes (space → %20) for URLs; HTML encoding uses &…; entities for page content.

Does decoding run any scripts?

No. Decoding uses an inert text area, so nothing in the input can execute.

Related tools & guides

Updated 2026-10-22 · by the htmlonline.dev team