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.
常见问题
我应该编码哪些字符?▼
我应该编码所有实体,还是只编码不安全的字符?▼
相关工具
JWT解码器
即时解码JSON Web Token(JWT)。完全在你的浏览器中运行:令牌绝不会离开你的设备,可安全用于生产环境的密钥。
JSON格式化与校验工具
在线格式化、校验和压缩JSON。完全在你的浏览器中运行:你的数据永远不会离开你的设备。
XML格式化工具
格式化并美化XML文档。适用于SOAP、站点地图、RSS订阅源和配置文件。
Base64编码与解码工具
将字符串编码为Base64,或将Base64解码为文本。尊重你的隐私:全部在你的浏览器中运行。
URL编码与解码工具
将文本转换为URL安全的编码(百分号编码),或进行反向转换。适用于查询字符串、重定向和OAuth流程。
CSS压缩工具
移除CSS中的注释、空白和不必要的字符,以减小文件体积。