FIRST CH TOOLS / 19 HTML ESCAPE
HTML Entity Escape & Unescape
Paste text and < > & " ' are turned into HTML entities. Paste entities such as & or ' and they are decoded back — same screen, either direction, updated as you type, with warnings for double escaping and unterminated references.
Type into either box — the other side follows
Escaping handles & first, so running it twice on plain text is harmless — if & becomes &amp;, the input was already escaped, and the Checks list says so. Decoding never silently drops an unknown entity name: anything it does not recognise is left untouched and listed for you.
Common entities (click any code to copy)
Only the common ones are listed here, but decoding covers all 252 named character references from HTML 4.01 (including Greek letters like α and symbols like ♥) plus decimal and hexadecimal numeric references.
How to Use
- Paste your textDrop HTML or plain text into the left box and the escaped form appears on the right. Paste entity-laden text into the right box and the original characters come back on the left.
- Match the options to the targetEscaping quotes is mandatory if the result goes inside an attribute. If the text has to survive a pipeline with a doubtful charset, switch non-ASCII to numeric references.
- Copy the resultHit Copy. Double escaping, bare ampersands, missing semicolons and unknown entity names are all listed under Checks.
About This Tool
In HTML, < means “a tag starts here” and & means “a character reference starts here”. Write either one raw in an article or a code sample and the browser reads it as an instruction rather than as text. To show them as characters you have to write < and & instead — that substitution is what escaping means.
Only & and < strictly have to be escaped in element text; > is optional (this tool converts it anyway, because the pair reads better). Inside an attribute value the quotes are mandatory. A raw " inside title="…" closes the attribute right there and everything after it is parsed as more attributes — the classic way an HTML injection gets in.
Apostrophes come out as ' by default. ' exists in XML and HTML5 but not in HTML 4.01, so old parsers print it literally. Tick the option only when you are working with XHTML or XML and prefer the readable name.
Numeric references (あ / あ) are insurance for pipelines where the character encoding may not survive — legacy mail systems, ASCII-only config files, a CMS whose charset nobody can confirm. On a page that correctly declares charset=UTF-8 they only make the source harder to read, so leave them off.
Unknown entity names are never guessed at. Browsers rescue some semicolon-less references such as  , but which ones they rescue is a historical accident and parsers disagree. This tool leaves them alone and tells you the semicolon is missing. Numeric references in the C1 range, like €, are mapped to their Windows-1252 characters (€ here) exactly as the HTML specification requires.
A no-break space (U+00A0) looks like an ordinary space but is a different character. It hitches a ride on text copied out of Word or a web page and then becomes the reason a string comparison mysteriously fails. This tool always writes it out as and tells you it is there.
Whatever you paste stays in your browser — the conversion and the checks all run locally. Directly callable via URL parameters: /en/html-escape/?text=<b>a&b</b> / /en/html-escape/?html=%26amp%3Bnbsp%3B
From AI Agents
The same escaping and decoding logic is available as the html_escape tool on the MCP (Model Context Protocol) server @first-ch/tools-mcp, so an AI agent can call it directly without driving a browser. See How to use from AI agents for setup.
Install
claude mcp add firstch-tools -- npx -y @first-ch/tools-mcp
Examples
# Escape HTML special characters html_escape(text="<a href='/x'>a & b</a>") # Decode entities back to characters html_escape(mode="unescape", text="<p>5 &lt; 10</p>") # Escape non-ASCII too, for charset-fragile pipelines html_escape(text="café & crème", nonAscii="hex") # Read a file, escape it, write the result out html_escape(path="/tmp/in.txt", outputPath="/tmp/out.html")
Other Tools
- 01Batch Image → WebPWebP Converter
- 02White Background RemoverWhite BG Remover
- 03WCAG Contrast CheckerContrast Checker
- 04Character CounterCharacter Counter
- 05llms.txt Generatorllms.txt Generator
- 06JSON-LD GeneratorJSON-LD Generator
- 07Markdown → PDFMD → PDF
- 08OGP Meta Tag WizardOGP Wizard
- 09Favicon GeneratorFavicon Generator
- 10TikTok PublisherTikTok Publisher
- 11Encoding & Line Ending ConverterEncoding Converter
- 12Batch Image → AVIF + pictureAVIF Converter
- 13Test Data GeneratorTest Data Generator
- 14Marp Markdown → SlidesMarp Slides
- 15Text & Code Diff CheckerDiff Checker
- 16Cron Explainer & Next RunsCron Explainer
- 17Base64 & Data URI EncoderBase64 & Data URI
- 18URL Parameter Editor & UTM BuilderURL Parameters
- 20JSON ⇄ YAML ConverterJSON ⇄ YAML
- 21PX ⇄ REM / EM ConverterPX ⇄ REM / EM 単位変換
- 22Color Converter & AlphaColorコード変換&アルファ透過
- 23MD5 / SHA-256 Hash Generatorハッシュ生成
- 24JWT Decoder & Expiry CheckerJWTデコーダー&有効期限チェッカー
- 25User-Agent ParserUser-Agent解析&デバイス判定
- 26UUID & ULID GeneratorUUID (v4) & ULID 一括生成
- 27Aspect Ratio Calculatorアスペクト比計算&サイズ算出