HTML Entity Encoder
Escape HTML special characters safely.
Free HTML entity encoder. Convert < > & quotes (and optionally all non-ASCII characters) into HTML entities so text displays safely in pages, in your browser.
Loading tool…
If the tool stays on this message, make sure JavaScript is enabled, then reload the page.
About HTML Entity Encoder
Type the characters for an HTML tag into a page and the browser doesn't display them, it tries to build the element. That's why HTML entities exist: they let you show the characters <, >, and & as text instead of having them swallowed as markup. Encoding is the quiet step behind every tutorial page that displays code samples correctly.
This encoder offers two scopes. Basic covers the markup characters, angle brackets, ampersands, and quotes, which is all most pasting-into-HTML tasks need. Full goes further and converts every non-ASCII character (accented letters, symbols, emoji) into numeric entities, useful for pages served without a UTF-8 charset or legacy systems that mangle anything beyond plain ASCII.
Choose your scope, paste the text, click encode, and copy the result. A word of caution for developers: encoding helps prevent broken markup and plays a role in XSS defense, but proper output escaping depends on context, what is safe in HTML body text isn't automatically safe inside attributes or scripts. Use your framework's escaping for security-critical paths.
How to use HTML Entity Encoder
- Choose Basic or Full encoding scope.
- Paste your text and click Encode.
- Copy the entity-escaped output.
Why use this tool?
- Basic mode for markup chars, Full for all non-ASCII
- Prevents broken markup when pasting into HTML
Tips for best results
- Basic mode handles nearly all CMS and blog pasting, reach for Full only with legacy non-UTF-8 systems.
- Always encode user-supplied text before injecting it into HTML; it's the first line of defense against broken pages and XSS.
- Context matters for security: body-text encoding isn't sufficient inside attributes, URLs, or script blocks.
- If your page declares UTF-8 (most do), you rarely need to encode accented characters. Save Full mode for exceptions.
- Encode once: double-encoding turns & into &amp;, which displays literally instead of as &.