HTML Entity Encoder
Escape text so it displays safely in HTML instead of being interpreted as markup.
Loading tool…
Need help with this tool or found a problem? WhatsApp support Email
What does the HTML Entity Encoder do?
Characters like < and & have special meaning in HTML. To show them as text — for example code samples in a blog post — they must be written as entities: <, &. Escaping user-provided text is also the basic defence against cross-site scripting (XSS).
Choose basic escaping, named entities for common symbols, or numeric entities for every non-ASCII character (useful for systems that do not handle UTF-8).
How to use the HTML Entity Encoder
- Paste the text or HTML you want to display literally.
- Choose the encoding level.
- Copy the escaped result into your HTML.
Examples
Code sample
<p class="note"> → <p class="note">.
Common use cases
- Showing code in blog posts and documentation
- Escaping user input in templates
- Preparing text for XML
Features and benefits
- Private by design — your data is processed on your device and never uploaded.
- Free with no account, no watermark and no usage limits.
- Works on phones, tablets and desktops in any modern browser.
Limitations to know
- For security, escape on the server or in your templating system too; this tool is for manual tasks.
Frequently asked questions
Which characters must be escaped?
& and < always; > and quotes inside attributes.
Named or numeric entities?
Both work in modern browsers. Numeric entities work for any character.
Does this prevent XSS?
Escaping is the core defence when inserting text into HTML, but use your framework’s built-in escaping in applications.
Related tools
All developer toolsHTML Entity Decoder
Decode HTML entities back into readable characters.
URL Encoder
Percent-encode text for safe use in URLs and query strings.
HTML Formatter
Indent and beautify HTML markup.
Text Cleaner
Strip HTML, smart quotes, emojis, line breaks and invisible characters.
Text ToolsBase64 Encoder
Encode text or files to Base64 with full UTF-8 support.
HTML Minifier
Minify HTML by removing comments and extra whitespace.