RevealTheme logo

HTMLエンティティエンコーダー&デコーダー

特殊文字をHTMLエンティティ(&、<など)に変換したり、その逆を行ったりします。テキストを安全にHTMLへ埋め込むのに役立ちます。

このツールの使い方

  1. 1

    Pick a mode with the Encode or Decode toggle at the top.

  2. 2

    Paste or type your text into the input box.

  3. 3

    Read the converted result in the output panel below, which updates as you type.

  4. 4

    Select and copy the output to use in your HTML or document.

HTMLエンティティエンコーダー&デコーダーとは何ですか?

HTMLエンティティは、HTMLで特別な意味を持つ文字を表すエスケープシーケンスです。&amp;は&を、&lt;は<を表す、といった具合です。ユーザーから提供されたテキストをエンコードせずにそのまま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 &amp;nbsp; or &amp;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 &#39; or &#x2014; decodes to without writing throwaway code.

よくある質問

どの文字をエンコードすべきですか?
最低限、< > & " 'はエンコードしてください。これらはHTMLで特別な意味を持ち、解析を壊したりXSSを引き起こしたりする可能性があります。
すべてのエンティティをエンコードすべきですか、それとも安全でないものだけですか?
最新のUTF-8ページでは、安全でない文字(&、<、>、"、')だけをエンコードしてください。すべてをエンコードするとHTMLが肥大化します。

関連ツール