HTMLエンティティ変換
特殊文字をHTMLエンティティへ変換、または元に戻します。
What is HTML Entity Encoder / Decoder?
HTML Entity Encoder / Decoder converts special characters to their HTML entity equivalents (e.g. < ↁE<)
and decodes them back. This prevents XSS (cross-site scripting) vulnerabilities when rendering user-supplied content in HTML.
How to use
- Paste your text into the input box.
- Click Encode to convert special HTML characters to entities.
- Click Decode to convert HTML entities back to characters.
- Copy the result with the Copy button.
Common HTML entities
&ↁE&<ↁE<>ↁE>"ↁE"'ↁE' ↁEnon-breaking space
FAQ
- Why do I need to encode HTML entities?
- Characters like
<,>, and&have special meaning in HTML. If user input containing these characters is inserted into HTML without encoding, a browser may execute it as code — a cross-site scripting (XSS) attack. - Should I encode all characters?
- Generally you only need to encode the five critical characters:
&,<,>,", and'. Over-encoding regular text can make it harder to read in source code. - What is the difference between named and numeric entities?
- Named entities like
&use a descriptive name. Numeric entities like&(decimal) or&(hex) use the Unicode code point. Both represent the same character.
概要
特殊文字をHTMLエンティティへエンコード、またはエンティティを通常の文字へデコードします。コード片やユーザー入力、マークアップ例をWebページに安全に表示する際に必須の処理です。
使い方
- 特殊文字またはHTMLエンティティを含むテキストを貼り付けます。
- Encode で < > & などをエンティティ化、Decode で元に戻します。
- 変換結果をコピーします。
使用例
-
ブログにコードを掲載
入力: <div class="box">
出力: <div class="box">
-
取得テキストのデコード
入力: Fish & Chips
出力: Fish & Chips
補足
- ユーザー入力をHTMLへ挿入する前にエンコードすると、XSS攻撃の防止に役立ちます。
- エンティティには名前付き(&)、10進(&)、16進(&)の形式があります。
- 変換はすべてブラウザ内で行われます。
よくある質問
- なぜHTMLエンティティ化が必要なのですか?
- < > & などはHTMLで特別な意味を持つため、エンコードしないとマークアップとして解釈されてしまいます。
- これだけでXSS対策は十分ですか?
- 出力エンコードは重要な一層ですが、テンプレートエンジンの活用、入力検証、CSPと組み合わせてください。
- 入力データは送信されますか?
- 送信されません。ブラウザ内で変換します。
Embed this tool
Paste this iframe into any HTML page to embed HTMLエンティティ変換 on your site: