What are HTML Entities?
HTML entities are special character sequences that represent characters with meaning in HTML. For example, < represents < and & represents &. Encoding prevents browsers from interpreting these characters as HTML tags or attributes. This tool encodes and decodes HTML entities, including named entities, numeric references, and Unicode characters.
Common use cases
- Encoding user input to prevent XSS (Cross-Site Scripting)
- Displaying code snippets with < and > in HTML pages
- Inserting special characters like ©, ®, and ™ in HTML
- Decoding HTML entities found in web scraping results
- Encoding strings for safe display in HTML email templates
How to use
- 1Choose Encode or Decode, and for encoding pick the format (named, decimal, hex) and scope.
- 2Type or paste text on the left — the output updates as you type.
- 3Copy the result, or search the entity reference below and click a code to copy it.
Frequently asked questions
When do I need to use HTML entities?
Always encode <, >, &, ", and ' when displaying user-generated content in HTML to prevent XSS attacks. Also use entities for special characters that aren't on your keyboard, like mathematical symbols, accented characters, and emoji.
What is the difference between named and numeric entities?
Named entities use readable names: & < ©. Numeric entities use Unicode code points: & < ©. Named entities are easier to read but not all characters have names. Numeric entities work for any Unicode character.