⚡ Curated dev resources & dealsSponsored
DevToolBayFree Developer Tools

HTML 实体编码解码器

HTML 实体互转:&、尖括号、引号五个关键字符转义;named/十进制/十六进制实体解码,双层编码逐层还原。

Action
Escape non-ASCII as &#x…;

When are entities needed?

Inside HTML text, the characters & < > (and " / ' inside attributes) must be escaped so the browser parses them as text instead of markup. Encoding converts them to &amp; &lt; &gt; &quot; &#39;. The checkbox additionally escapes every non-ASCII character (é → &#xE9;) for legacy E-mail templates and old CMSes; uncheck it to keep Unicode intact and escape only the five markup characters. Decoding understands all named, decimal and hex numeric entities.

如何使用HTML 实体编码解码器

把不可信文本、HTML 片段或渲染后的内容粘贴进来:Encode 只转义五个关键字符(&、尖括号、引号),Decode 反向还原,多层编码连点两次即可逐层剥开。占位符示例演示了混排场景转义前后的差别。

用户输入进入 HTML 模板前先转义,就能挡住经典注入向量并保持标记合法。像 &lt;div&gt; 这种双层产物,一两次解码就恢复原貌,每个字符对应哪个实体全程可见。

相关工具