HTML 实体

HTML 文本编码与解码

正在加载工具…

关于 HTML 实体

HTML 文本编码与解码

Encoding is useful when text must be displayed as text instead of interpreted as markup. It is context-dependent: HTML text, an HTML attribute, JavaScript, a URL, and a database query each have different escaping rules.

如何使用这个开发者工具

  1. Choose encode or decode mode and paste the text you need to inspect.
  2. Run the conversion and compare characters such as ampersands, quotes, and angle brackets.
  3. Copy the result into the correct output context and apply that context's validation or sanitization rules.

隐私与数据处理

The conversion runs locally in your browser. The result is an encoded representation, not a security review; do not use it as a substitute for context-aware sanitization of untrusted input.

相关开发者工具

常见问题

Does HTML entity encoding sanitize a page?

No. It transforms characters for one HTML context. Safe rendering also requires correct context handling, sanitization, and a safe page architecture.

Why are some characters encoded as numbers?

Numeric entities can represent a character by code point and are useful when a named entity is unavailable or ambiguous.

Should I encode an entire URL with this tool?

No. URLs have their own percent-encoding rules. Use the URL encoder for URL components and complete URIs.