HTML实体编码与解码工具
将特殊字符转换为HTML实体(&、<等),或进行反向转换。适用于将文本安全地嵌入HTML。
如何使用本工具
- 1
Pick a mode with the Encode or Decode toggle at the top.
- 2
Paste or type your text into the input box.
- 3
Read the converted result in the output panel below, which updates as you type.
- 4
Select and copy the output to use in your HTML or document.
什么是HTML实体编码与解码工具?
HTML实体是用来表示在HTML中具有特殊含义的字符的转义序列:&表示&,<表示<,等等。如果你将用户提供的文本不经编码就直接嵌入HTML,就会造成XSS漏洞。本工具可将文本转换为已编码实体的HTML以便安全嵌入,或将含有实体的HTML解码还原为纯文本。
常见使用场景
Pasting a code snippet into a blog post or docs so tags like <div> display literally instead of rendering.
Escaping user-supplied text before dropping it into an HTML template to avoid breaking the markup.
Decoding entity-laden strings copied from page source, RSS feeds, or scraped HTML back into readable text.
Turning a stray &nbsp; or &mdash; from a CMS export back into a normal space or em dash.
Preparing example strings for tutorials where you need to show the raw entity form of a character.
Quickly checking what ' or — decodes to without writing throwaway code.
常见问题
我应该编码哪些字符?▼
我应该编码所有实体,还是只编码不安全的字符?▼
相关工具
CSS压缩工具
移除CSS中的注释、空白和不必要的字符,以减小文件体积。
HTML压缩工具
移除HTML中的空白和注释。适用于嵌入代码、邮件模板或生产环境的HTML。
JavaScript压缩工具
基础的JavaScript压缩:移除注释和不必要的空白。生产环境请使用真正的压缩工具(Terser、esbuild)。
正则表达式测试器
针对任意输入测试JavaScript正则表达式。实时查看匹配项、捕获组和替换结果。
哈希生成器(MD5 / SHA)
生成加密哈希:MD5、SHA-1、SHA-256、SHA-384和SHA-512。通过Web Crypto API在你的浏览器中运行。
UUID生成工具
在线生成UUID v4(通用唯一标识符,随机版)。每次点击都会在你的浏览器中生成一个新的。