encoded becomes <script>… — the browser displays it as text instead of executing it. Encoding untrusted output is the primary XSS defense; template auto-escaping automates it."}},{"@type":"Question","name":"Why does my page show &lt; instead of
TontonTools

HTML Encoder

Encode HTML entities — make text safe to display inside HTML.

100% Free No signup Privacy-friendly Web Development
Updated Sep 2026
Decode instead
Share X / Twitter Facebook LinkedIn WhatsApp

How to use HTML Encoder

  1. Paste the text or code that must display (not execute) inside HTML.
  2. Copy the encoded output — < > & and quotes are now entities.
  3. Drop it into your markup — it renders as visible characters.
  4. Encode exactly once — double-encoding shows &amp;lt; artifacts; the Decoder unwinds them.

What is HTML Encoder?

An HTML encoder converts characters that have meaning in HTML into their harmless entity forms: < becomes &lt;, > becomes &gt;, & becomes &amp;, and quotes become &quot;/&#39;. Encoded text displays as those characters instead of being parsed as markup.

Two reasons to encode: showing code on a web page (an unencoded <script> example would execute or vanish instead of displaying), and security — HTML-encoding untrusted text before rendering is THE core defense against cross-site scripting (XSS), turning an attacker's injected <script> into inert visible text.

About the HTML Encoder

Paste text or code and get the HTML-encoded version instantly — every significant character converted to its entity, ready to drop into markup.

The everyday case is publishing code: tutorial snippets, HTML examples inside HTML pages, code in blog CMSs that don't auto-escape. Encode first, and <div class="example"> displays literally instead of becoming an actual div. The security case is deeper: any user-supplied text (comments, names, search terms) echoed into a page must be encoded at output — it's what template engines' auto-escaping does, and this tool shows you exactly what that transformation produces.

Encoding's mirror is the HTML Decoder, which turns entities back into characters — useful for reading encoded source or double-encoded messes (&amp;lt; artifacts), the classic symptom of encoding twice.

Frequently Asked Questions

The five with markup meaning: < (&lt;), > (&gt;), & (&amp;), " (&quot;) and ' (&#39;). Encoding & matters even in plain prose — "AT&T" unencoded can swallow following text as an entity attempt.
Injected <script>alert(1)</script> encoded becomes &lt;script&gt;… — the browser displays it as text instead of executing it. Encoding untrusted output is the primary XSS defense; template auto-escaping automates it.
Double encoding — already-encoded text was encoded again (&lt; → &amp;lt;). Common when a CMS auto-escapes what you pre-escaped. Encode once, at the final output step.
Not on UTF-8 pages (the modern default) — é and ™ can appear literally. Named entities for them (&eacute;) are legacy practice; only the five structural characters still require encoding.
When the text is meant to BE markup — encoding your template's actual HTML renders it as visible tag soup. Encode data going into HTML; never the HTML itself.

We use cookies for analytics and to keep the tools free via ads. See our Privacy Policy.