HTML Encoder / Decoder
HTML विशेष characters को escape करें या entities को वापस decode करें। User input को सुरक्षित रूप से embed करने या encoded markup debug करने के लिए उपयोगी।
परिणाम देखने के लिए ऊपर इनपुट डालें।
JXXR1 द्वारा बनाया गया · ♥ स्पॉन्सर करें · ☕ मुझे coffee दिलाएं
यह किसके लिए है?
HTML structural अर्थ के साथ पांच characters reserve करता है — &, <, >, ", '। इनमें से किसी को भी page में content के रूप में डालने के लिए उन्हें HTML entities के रूप में escape करना आवश्यक है ताकि browser उन्हें markup के रूप में interpret न करे। यह tool दोनों directions में flip करता है: raw text को safe entities में encode करें, या scraped HTML को वापस plain text में decode करें।
कब इस्तेमाल करें
- HTML में untrusted user content embed करना — XSS रोकने के लिए पहले encode करें।
- Scraped या copy-pasted markup जो entities के साथ आया (
&,',“) को decode करना। - गलती से double-escaped templates को un-mangle करना।
- JSDoc, CDATA-free XML, या markdown code fences के लिए snippets तैयार करना जिनमें literal angle brackets की आवश्यकता है।
आम गलतियाँ
- Encoding sanitisation नहीं है। Encoding text को display के लिए safe बनाता है; यदि आप tags को भी strip करना चाहते हैं, तो आपको HTML sanitiser की आवश्यकता है।
- Attributes बनाम body। दोनों contexts को same पांच characters escape चाहिए, लेकिन
onclickजैसे JavaScript event handlers को अतिरिक्त escaping चाहिए (जो यह tool नहीं करता — untrusted data को attributes से बाहर रखें)। - Decoder permissive है। Named entities (
“), decimal (") और hex (") सभी browser के parser के माध्यम से decode होते हैं, इसलिए यह वही स्वीकार करता है जो एक असली browser करेगा। - Double-encode न करें। पहले से encoded value को encode करने पर
&amp;मिलता है। यदि आप अपने input में entities देखते हैं तो पहले decode करें।