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 أو فك ترميز الكيانات لاستعادة النص المقروء.

أدوات ذات صلة