Skip to main content
SiteIndex
開発者向けすぐに利用できます

HTMLをエスケープ・デコード

特殊文字をHTMLエンティティに変換、またはエンティティを読みやすいテキストに戻します。

使い方ガイド

ツール操作エリア

アカウント不要
HTMLエンティティ変換

51 characters in · 51 characters out — the conversion updates live as you type.

Why escape? The XSS example

Inserted into a page unescaped, this user input would run as code:

<script>alert('XSS')</script>

Escaped, the browser displays it as harmless text instead:

&lt;script&gt;alert(&#039;XSS&#039;)&lt;/script&gt;
Copyable JavaScript snippets
escapeHtml
function escapeHtml(text) {
  return text
    .replace(/&/g, "&amp;")
    .replace(/</g, "&lt;")
    .replace(/>/g, "&gt;")
    .replace(/"/g, "&quot;")
    .replace(/'/g, "&#039;");
}
unescapeHtml
function unescapeHtml(text) {
  const textarea = document.createElement("textarea");
  textarea.innerHTML = text;
  return textarea.value;
}
Entity reference
CharacterNamedDecimalHexDescription
&&amp;&#38;&#x26;Ampersand — always escape this one first, or the other entities break
<&lt;&#60;&#x3C;Less-than sign — starts a tag if left raw
>&gt;&#62;&#x3E;Greater-than sign — closes a tag if left raw
"&quot;&#34;&#x22;Quotation mark — ends a double-quoted attribute value if left raw
'&apos;&#39;&#x27;Apostrophe — ends a single-quoted attribute value (&#039; is the widely compatible form)
␣&nbsp;&#160;&#xA0;Non-breaking space — renders as a space that cannot wrap or collapse
©&copy;&#169;&#xA9;Copyright sign
®&reg;&#174;&#xAE;Registered trademark sign
™&trade;&#8482;&#x2122;Trademark sign
€&euro;&#8364;&#x20AC;Euro sign
HTMLエンティティ変換とは

特殊文字をHTMLエンティティに変換、またはエンティティを読みやすいテキストに戻します。

使い方

特殊文字をHTMLエンティティに変換、またはエンティティを読みやすいテキストに戻します。

よくある用途

特殊文字をHTMLエンティティに変換、またはエンティティを読みやすいテキストに戻します。

利用上の注意

結果はブラウザー、ネットワーク、入力内容、外部サービスによって異なる場合があります。このツールは情報提供を目的としており、専門的な診断や助言に代わるものではありません。

よくある質問
HTMLエンティティ変換とは
特殊文字をHTMLエンティティに変換、またはエンティティを読みやすいテキストに戻します。

関連ツール