HTML Encoder
Escape HTML special characters to prevent broken or unsafe markup.
Nothing encoded yet
Paste text or markup to escape the characters an HTML parser would otherwise treat as structure.
Runs entirely in your browser. Your data isn't uploaded — this page makes no network request with anything you type, which you can verify in your browser's network tab. How this works.
What is the HTML Encoder?
HTML encoding replaces characters that the parser treats as markup with named or numeric entities, so text renders as text. It is the mechanical part of preventing cross-site scripting when interpolating untrusted values into a page, and it is also how you show a code sample without the browser executing it.
This tool escapes the five characters that matter — & < > " ' — and can optionally encode every non-ASCII character for systems that cannot carry UTF-8.
How to use it
- Paste the text or markup you want to escape.
- Pick basic escaping or full non-ASCII encoding.
- Press Encode (or Ctrl/Cmd + Enter), then copy the result.
Example
Markup escaped so it renders as text.
<a href="/x">Tom & Jerry</a>
<a href="/x">Tom & Jerry</a>
Features
- Escapes &, <, >, " and ' — the set needed for both text and attribute contexts
- Optional numeric encoding of all non-ASCII characters
- Named or numeric entity output
- Round-trip check against the decoder so you can verify nothing was lost