Monu Tools

Mã hóa / giải mã thực thể HTML

Mã hóa văn bản thành thực thể HTML hoặc giải mã thực thể trở lại văn bản, an toàn UTF-8 và ở phía máy khách.

Cách dùng Mã hóa HTML

  1. 01

    Dán văn bản hoặc HTML của bạn.

  2. 02

    Chọn Mã hóa (thoát các ký tự HTML đặc biệt), Mã hóa tất cả (thoát cả ký tự ngoài ASCII) hoặc Giải mã.

  3. 03

    Sao chép kết quả.

What it does

An HTML entity encoder and decoder for escaping special characters so they display as text instead of being interpreted as markup. It converts characters like < and & into entities such as &lt; and &amp;, and decodes them back again.

Encoding and decoding are UTF-8 safe and run entirely in your browser, so nothing you paste is uploaded.

How encoding works

Encoding always escapes the five characters that have special meaning in HTML: & < > " and '. That is what stops a stray < from being read as the start of a tag, or text from accidentally breaking out of an attribute.

An Encode all option additionally turns every non-ASCII character into a numeric entity, which is useful for legacy systems, some email pipelines, or anywhere you need to be sure the output is pure ASCII.

What decoding understands

Decoding understands all three entity forms: named entities like &amp; and &copy;, decimal entities like &#233;, and hexadecimal entities like &#x20AC;. Sequences it does not recognize are left untouched rather than mangled.

Encoding and XSS

Escaping the HTML specials is the core defense against HTML injection and cross-site scripting (XSS): any untrusted text should be encoded before it is placed into a page, so it renders as harmless characters instead of active markup.

Câu hỏi thường gặp

Khác biệt giữa Mã hóa và Mã hóa tất cả là gì?

Mã hóa chỉ thoát năm ký tự bắt buộc phải thoát trong HTML (& < > " '). Mã hóa tất cả còn biến mọi ký tự ngoài ASCII thành thực thể số, hữu ích cho hệ thống cũ hoặc email.

Nó giải mã được những thực thể nào?

Thực thể có tên như &amp; và &copy;, thực thể thập phân như &#233;, và thực thể thập lục phân như &#x20AC;. Các chuỗi không xác định được giữ nguyên.

Nó có ngăn XSS không?

Mã hóa các ký tự HTML đặc biệt là biện pháp phòng vệ cốt lõi chống chèn mã đánh dấu. Luôn mã hóa văn bản không tin cậy trước khi đặt vào HTML.

Nguồn

Nhúng công cụ này

Thêm công cụ này vào trang web của riêng bạn. Sao chép đoạn mã bên dưới; nó tự động cập nhật.

<iframe src="https://monu.tools/embed/vi/html-encoder" width="100%" height="640" style="border:1px solid #e5e5e5;border-radius:12px;max-width:680px" loading="lazy" title="Monu Tools"></iframe>

Công cụ liên quan