HTML Entity Encoder
Escape text so it displays safely inside HTML. Choose which characters to encode and how.
How to use the HTML Entity Encoder
- Paste your textType or paste text, or a code snippet you want to show on a web page.
- Pick what to encodeEncode only the five special characters, or also accents, symbols and emoji, as named, decimal or hex entities.
- Copy the resultPaste the encoded text into your HTML. It will display exactly as typed.
Example
<p>Tom & Jerry</p> → <p>Tom & Jerry</p>
With non-ASCII on, © becomes © (named), © (decimal) or © (hex).
Frequently asked questions
Why do I need to encode HTML?
Characters like < and & have special meaning in HTML. Encoding them lets you show code or user text on a page without the browser treating it as markup, and it helps prevent cross-site scripting (XSS).
Which characters must always be encoded?
In text, & and < must be encoded. Inside attribute values, also encode the quote you use around the value. The basic option encodes & < > " and ' to be safe everywhere.
Named or numeric entities?
Both work in all browsers. Named entities like © are easier to read; numeric ones like © cover every Unicode character, including emoji.