將文字編碼為 HTML 實體,或將實體解碼回文字,UTF-8 安全且在用戶端執行。
如何使用 HTML 編碼
貼上你的文字或 HTML。
選擇編碼(跳脫 HTML 特殊字元)、全部編碼(同時跳脫非 ASCII)或解碼。
複製結果。
An HTML entity encoder and decoder for escaping special characters so they display as text instead of being interpreted as markup. It converts characters like < and & into entities such as < and &, and decodes them back again.
Encoding and decoding are UTF-8 safe and run entirely in your browser, so nothing you paste is uploaded.
Encoding always escapes the five characters that have special meaning in HTML: & < > " and '. That is what stops a stray < from being read as the start of a tag, or text from accidentally breaking out of an attribute.
An Encode all option additionally turns every non-ASCII character into a numeric entity, which is useful for legacy systems, some email pipelines, or anywhere you need to be sure the output is pure ASCII.
Decoding understands all three entity forms: named entities like & and ©, decimal entities like é, and hexadecimal entities like €. Sequences it does not recognize are left untouched rather than mangled.
Escaping the HTML specials is the core defense against HTML injection and cross-site scripting (XSS): any untrusted text should be encoded before it is placed into a page, so it renders as harmless characters instead of active markup.
常見問題
編碼只跳脫 HTML 中必須跳脫的五個字元(& < > " ')。全部編碼還會將每個非 ASCII 字元轉換為數字實體,適用於舊系統或電子郵件。
命名實體如 & 和 ©,十進位實體如 é,以及十六進位實體如 €。未知序列會保持不變。
跳脫 HTML 特殊字元是防止注入標記的核心手段。在將不可信文字放入 HTML 之前,請始終進行編碼。
嵌入此工具
將此工具加入你自己的網站。複製下方的程式碼片段,它會自動保持最新。
<iframe src="https://monu.tools/embed/zh-Hant/html-encoder" width="100%" height="640" style="border:1px solid #e5e5e5;border-radius:12px;max-width:680px" loading="lazy" title="Monu Tools"></iframe>相關工具