Complete User Guide to HTML Entity Encoding, Escaping Reserved Characters, and XSS Prevention

What Are HTML Entities and Why Should You Encode Special Characters?

In HTML documents, characters such as <, >, &, ", and ' have reserved syntactic meanings—they open tags, close tags, start entity references, or delimit attribute values. If you paste raw code examples, mathematical comparisons (like x < y), or untrusted user input directly into an HTML page without escaping those symbols, the browser interprets them as markup rather than visible text. Worse, unescaped markup in dynamic templates can create Cross-Site Scripting (XSS) vulnerabilities. An HTML Entity Encoder replaces reserved and non-ASCII characters with standardized named or numeric HTML entities (such as <, >, and &) so browsers render every character safely as literal text.

How to Encode or Decode HTML Entities in 3 Easy Steps

  1. Choose Conversion Mode: Select Encode to Entities to escape raw HTML/text into safe entities, or Decode to Text to turn escaped entities back into readable characters.
  2. Paste Your Content: Enter your markup snippet, attribute string, or symbol-heavy copy into the input box; toggle Encode Non-ASCII if you also want accented letters or symbols converted into numeric code points (©).
  3. Copy or Export Safely: Click Copy Result to place the escaped string on your clipboard or download it as a .txt snippet.

HTML Entity Escaping & Numeric Code Point Formula

Every HTML entity starts with an ampersand (&) and ends with a semicolon (;), represented either by an HTML5 named entity or a decimal/hexadecimal Unicode scalar value:

Named Entity: &name; (e.g., <)  |  Decimal Entity: &#codePoint; (e.g., <)  |  Hex Entity: &#xHex; (e.g., <)

Best Practices for Escaping HTML in Web Templates

Worked Example: Encoding Click converts the angle brackets, quotes, and ampersand into <a href="https://example.com?a=1&b=2">Click</a>, allowing you to display HTML tutorials safely inside blocks.

Essential HTML Named & Numeric Entities Reference (16 Rules)

Use this reference table to look up standard HTML5 named entities, decimal codes, and usage notes.

Character Named Entity Numeric Entity Description / Usage
& & & Ampersand (must be escaped first)
< < < Less-than sign / opening HTML tag delimiter
> > > Greater-than sign / closing HTML tag delimiter
" " " Double quotation mark for HTML attributes
' ' ' Single quotation mark / apostrophe (' is universal)
  (space)     Non-breaking space preventing line wrap
© © © Copyright symbol
® ® ® Registered trademark symbol
™ ™ ™ Trademark symbol
€ € € Euro currency sign
£ £ £ British Pound sterling sign
— — — Em dash punctuation mark
→ → → Rightwards arrow symbol
Client-Side Engine Browser JavaScript String & DOM Parser — Zero Server Latency
Server Uploads None — All encoding and decoding happen locally in your browser
Privacy Status 100% Local Processing — Your code snippets stay strictly on your device

Formatting HTML, URLs, or Base64 strings? Explore our companion client-side utilities:

Frequently Asked Questions

The five core XML/HTML characters are & (&), < (<), > (>), " ("), and ' (').
Yes! Switch to Decode to Text mode to convert both named entities (like © or <) and numeric entities (like © or <) back to plain text.
Never. All encoding and decoding execute 100% locally inside your web browser.
Yes! It is completely free with no login or usage limits.