HTML Entity Encoder

HTML Entity Encoder

Encode text to HTML entities online — escape special characters like <, >, &, and " instantly in your browser. No install needed.

Updated April 2026

Shift + Enter to Copy · Shift + for tabs
Encoding Mode:
Text to Encode
0 characters
HTML Entities Output
Speed
Privacy
Local Only
Size
0 KB

HTML Entity Encoder Online — Escape HTML Characters Free

Stop worrying about broken HTML from user-generated content or template injection bugs. This free HTML Entity Encoder converts any raw text into properly escaped HTML entities — instantly, directly in your browser, with zero data sent to any server.

Whether you're sanitizing content before inserting it into a webpage, writing code examples for documentation, or debugging an email template, this tool produces clean, safe, copy-ready output in milliseconds.

How to Use the HTML Entity Encoder

  1. Paste your text — type or paste any string into the input area.
  2. Choose an encoding mode — pick the mode that matches your use case (see below).
  3. See the result instantly — the encoded output appears in real time as you type.
  4. Copy the output — click Copy or press Shift+Enter to copy the encoded result to your clipboard.

Switch to the Decode tab at any time to reverse the process, or click "Swap & Decode" to send the encoded output directly to the decoder.

Encoding Modes

Mode What it encodes Best for
Essential & < > " ' only XSS prevention, HTML attribute safety
Named Entities All chars with official HTML names (accents, symbols, currency…) Legacy systems, maximum named-entity coverage
Numeric (&#…;) All non-ASCII as &#NNNN; decimal refs Maximum compatibility with older parsers

HTML Entities — What They Are and Why They Matter

HTML entities are text representations of characters that have special meaning in HTML, or characters that may not be safely embedded as raw Unicode. There are three equivalent forms for any entity:

  • Named: &aacute; — human-readable, part of the HTML5 spec
  • Decimal numeric: &#225; — universal, no name required
  • Hex numeric: &#xE1; — same value in hexadecimal

Essential Entities (XSS-Critical)

These five characters must always be escaped when inserting arbitrary text into HTML:

Character Named Entity Numeric Description
& &amp; &#38; Ampersand — starts every entity
< &lt; &#60; Less-than — opens HTML tags
> &gt; &#62; Greater-than — closes HTML tags
" &quot; &#34; Double quote — delimits attribute values
' &#39; &#39; Single quote — alternative attribute delimiter

Without escaping these, user-supplied text can inject markup or trigger XSS attacks.

Accented Latin — Uppercase

Character Named Entity Numeric Description
À &Agrave; &#192; A with grave accent
Á &Aacute; &#193; A with acute accent
 &Acirc; &#194; A with circumflex
à &Atilde; &#195; A with tilde
Ä &Auml; &#196; A with umlaut
Å &Aring; &#197; A with ring above
Æ &AElig; &#198; AE ligature
Ç &Ccedil; &#199; C with cedilla
È &Egrave; &#200; E with grave accent
É &Eacute; &#201; E with acute accent
Ê &Ecirc; &#202; E with circumflex
Ë &Euml; &#203; E with umlaut
Ì &Igrave; &#204; I with grave accent
Í &Iacute; &#205; I with acute accent
Î &Icirc; &#206; I with circumflex
Ï &Iuml; &#207; I with umlaut
Ñ &Ntilde; &#209; N with tilde
Ò &Ograve; &#210; O with grave accent
Ó &Oacute; &#211; O with acute accent
Ô &Ocirc; &#212; O with circumflex
Õ &Otilde; &#213; O with tilde
Ö &Ouml; &#214; O with umlaut
Ø &Oslash; &#216; O with stroke
Ù &Ugrave; &#217; U with grave accent
Ú &Uacute; &#218; U with acute accent
Û &Ucirc; &#219; U with circumflex
Ü &Uuml; &#220; U with umlaut
Ý &Yacute; &#221; Y with acute accent
Þ &THORN; &#222; Latin capital thorn
ß &szlig; &#223; Latin sharp S (German)

Accented Latin — Lowercase

Character Named Entity Numeric Description
à &agrave; &#224; a with grave accent
á &aacute; &#225; a with acute accent
â &acirc; &#226; a with circumflex
ã &atilde; &#227; a with tilde
ä &auml; &#228; a with umlaut
å &aring; &#229; a with ring above
æ &aelig; &#230; ae ligature
ç &ccedil; &#231; c with cedilla
è &egrave; &#232; e with grave accent
é &eacute; &#233; e with acute accent
ê &ecirc; &#234; e with circumflex
ë &euml; &#235; e with umlaut
ì &igrave; &#236; i with grave accent
í &iacute; &#237; i with acute accent
î &icirc; &#238; i with circumflex
ï &iuml; &#239; i with umlaut
ð &eth; &#240; Latin small eth
ñ &ntilde; &#241; n with tilde
ò &ograve; &#242; o with grave accent
ó &oacute; &#243; o with acute accent
ô &ocirc; &#244; o with circumflex
õ &otilde; &#245; o with tilde
ö &ouml; &#246; o with umlaut
ø &oslash; &#248; o with stroke
ù &ugrave; &#249; u with grave accent
ú &uacute; &#250; u with acute accent
û &ucirc; &#251; u with circumflex
ü &uuml; &#252; u with umlaut
ý &yacute; &#253; y with acute accent
þ &thorn; &#254; Latin small thorn
ÿ &yuml; &#255; y with umlaut

Currency & Commerce

Character Named Entity Numeric Description
&euro; &#8364; Euro sign
£ &pound; &#163; Pound sterling
¥ &yen; &#165; Yen / Yuan sign
¢ &cent; &#162; Cent sign
¤ &curren; &#164; Generic currency sign
© &copy; &#169; Copyright
® &reg; &#174; Registered trademark
&trade; &#8482; Trademark symbol

Punctuation & Typography

Character Named Entity Numeric Description
&nbsp; &#160; Non-breaking space
&ndash; &#8211; En dash
&mdash; &#8212; Em dash
&hellip; &#8230; Ellipsis
' &lsquo; &#8216; Left single quotation mark
' &rsquo; &#8217; Right single quotation mark
" &ldquo; &#8220; Left double quotation mark
" &rdquo; &#8221; Right double quotation mark
« &laquo; &#171; Left-pointing double angle quotation
» &raquo; &#187; Right-pointing double angle quotation
&lsaquo; &#8249; Single left-pointing angle quotation
&rsaquo; &#8250; Single right-pointing angle quotation
° &deg; &#176; Degree sign
· &middot; &#183; Middle dot
&para; &#182; Pilcrow (paragraph)
§ &sect; &#167; Section sign
&bull; &#8226; Bullet
&dagger; &#8224; Dagger
&Dagger; &#8225; Double dagger
&permil; &#8240; Per mille sign

Math & Science

Character Named Entity Numeric Description
× &times; &#215; Multiplication sign
÷ &divide; &#247; Division sign
± &plusmn; &#177; Plus-minus sign
&minus; &#8722; Minus sign
² &sup2; &#178; Superscript two
³ &sup3; &#179; Superscript three
¼ &frac14; &#188; Vulgar fraction one quarter
½ &frac12; &#189; Vulgar fraction one half
¾ &frac34; &#190; Vulgar fraction three quarters
&infin; &#8734; Infinity
&radic; &#8730; Square root
&sum; &#8721; N-ary summation
&prod; &#8719; N-ary product
&part; &#8706; Partial differential
&int; &#8747; Integral
&ne; &#8800; Not equal to
&le; &#8804; Less-than or equal to
&ge; &#8805; Greater-than or equal to
&asymp; &#8776; Almost equal to
&isin; &#8712; Element of
&notin; &#8713; Not an element of
&cap; &#8745; Intersection
&cup; &#8746; Union

Arrows

Character Named Entity Numeric Description
&larr; &#8592; Leftwards arrow
&rarr; &#8594; Rightwards arrow
&uarr; &#8593; Upwards arrow
&darr; &#8595; Downwards arrow
&harr; &#8596; Left right arrow
&crarr; &#8629; Carriage return arrow
&lArr; &#8656; Leftwards double arrow
&rArr; &#8658; Rightwards double arrow
&uArr; &#8657; Upwards double arrow
&dArr; &#8659; Downwards double arrow
&hArr; &#8660; Left right double arrow

Greek Letters

Character Named Entity Numeric Description
Α &Alpha; &#913; Greek capital Alpha
Β &Beta; &#914; Greek capital Beta
Γ &Gamma; &#915; Greek capital Gamma
Δ &Delta; &#916; Greek capital Delta
Θ &Theta; &#920; Greek capital Theta
Λ &Lambda; &#923; Greek capital Lambda
Π &Pi; &#928; Greek capital Pi
Σ &Sigma; &#931; Greek capital Sigma
Φ &Phi; &#934; Greek capital Phi
Ω &Omega; &#937; Greek capital Omega
α &alpha; &#945; Greek small alpha
β &beta; &#946; Greek small beta
γ &gamma; &#947; Greek small gamma
δ &delta; &#948; Greek small delta
ε &epsilon; &#949; Greek small epsilon
θ &theta; &#952; Greek small theta
λ &lambda; &#955; Greek small lambda
μ &mu; &#956; Greek small mu
π &pi; &#960; Greek small pi
σ &sigma; &#963; Greek small sigma
τ &tau; &#964; Greek small tau
φ &phi; &#966; Greek small phi
ω &omega; &#969; Greek small omega

Miscellaneous Symbols

Character Named Entity Numeric Description
&spades; &#9824; Black spade suit
&clubs; &#9827; Black club suit
&hearts; &#9829; Black heart suit
&diams; &#9830; Black diamond suit
&loz; &#9674; Lozenge

Common Use Cases

  • Preventing XSS in web applications: Before rendering user-submitted content (comments, profile bios, form data) inside HTML, always encode it. A user who enters <script>alert(1)</script> should see that text displayed, not executed.
  • Writing code examples in HTML documents: When documenting HTML itself, you need to show raw tags as readable text. Encoding <div class="example"> lets it display correctly in a <pre> block without browser interpretation.
  • Email template development: Many email clients handle HTML differently. Encoding special characters in subject lines, dynamic fields, and body text prevents rendering issues across Gmail, Outlook, and Apple Mail.
  • CMS and headless content entry: Pasting encoded content into WordPress, Contentful, or Sanity fields that render raw HTML ensures special characters survive the round-trip from database to browser.
  • API response sanitization: When your backend returns user-generated strings that will be embedded in HTML responses, encode them server-side — or use this tool to verify that your encoding logic produces the expected output.

Frequently Asked Questions

What is the difference between HTML encoding and URL encoding?

HTML encoding replaces characters with HTML entity syntax (e.g., < becomes &lt;) so they display safely inside HTML documents. URL encoding percent-encodes characters (e.g., < becomes %3C) so they transmit safely in URLs and query strings. Use HTML encoding when inserting content into HTML; use URL encoding when building links or API requests.

Which encoding mode should I choose?

Use Essential for the vast majority of cases — it prevents XSS and covers all security-critical characters. Modern browsers and UTF-8 pages handle accented characters and symbols natively, so you only need Named Entities or Numeric when working with legacy systems, old email clients, or parsers that don't handle raw Unicode.

Is it safe to use this tool with sensitive data?

Yes. All processing happens entirely in your browser using JavaScript. No text is sent to any server, stored, or logged. You can encode confidential content without any privacy risk.

What is the difference between escape HTML and encode HTML entities?

They refer to the same operation. "Escape" is the verb — you escape a character so it loses its special meaning. "Encode" describes the transformation — you encode it into an entity representation. "HTML escape" and "HTML entity encode" are interchangeable terms for the same process.

Can I use the encoded output directly in JavaScript template literals or JSX?

In JSX and most modern frameworks (React, Svelte, Vue), the framework handles HTML escaping automatically when you use expression bindings like {variable}. Manual encoding is needed when you use dangerouslySetInnerHTML, innerHTML, or when generating raw HTML strings server-side. When in doubt, let the framework escape — only encode manually when you're working at the raw HTML string level.

Resources

Related Tools