---
title: "HTML escape and unescape — free, runs in your browser"
description: "Convert characters to HTML entities so markup displays as text, or convert back. Free, no sign-up, and nothing you enter leaves your browser."
url: https://atoneplace.net/tools/html-escape/
site: "At One Place"
---
# HTML escape and unescape
Convert characters to HTML entities so markup displays as text, or convert back.
## How it works
Escapes the characters that have meaning in HTML — & < > " and ’ — into their entity forms, so markup displays as literal text instead of being rendered. Unescaping reverses it.
The ampersand must be escaped first, and this tool does that. Escaping it last would double-escape every entity produced by the earlier substitutions, turning < into <. It is the classic ordering bug in hand-written escaping.
Escaping user input before inserting it into a page is the basic defence against cross-site scripting, though using the DOM’s textContent rather than innerHTML is safer still, because it never treats the input as markup at all.
> This tool runs entirely in your browser. Nothing you enter is sent to a server, logged or stored, and the page keeps working with the network disconnected.
## Common questions
### Which characters need escaping in HTML?
At minimum & < and >, plus double and single quotes inside attribute values. The ampersand must be escaped first or the others get double-escaped.
### Is escaping enough to prevent XSS?
It is the basic step, but context matters — escaping rules differ inside attributes, URLs and script blocks. Setting textContent rather than innerHTML avoids the problem entirely.
## Related pages
- [Word and character counter](https://atoneplace.net/tools/word-counter/)
- [Typing speed test](https://atoneplace.net/tools/typing-speed-test/)
- [Remove duplicate lines](https://atoneplace.net/tools/remove-duplicate-lines/)
- [Sort lines alphabetically](https://atoneplace.net/tools/sort-lines/)
- [JSON formatter and validator](https://atoneplace.net/tools/json-formatter/)
- [Text compare](https://atoneplace.net/tools/text-diff/)
- [Regex tester](https://atoneplace.net/tools/regex-tester/)
- [Case converter](https://atoneplace.net/tools/case-converter/)
- [Remove empty lines](https://atoneplace.net/tools/remove-empty-lines/)
- [Find and replace](https://atoneplace.net/tools/find-and-replace/)