./prontouso.com
CÔNG CỤ LẬP TRÌNH

Chuyển Đổi Thực Thể HTML

Chuyển đổi các ký tự đặc biệt như <, >, &, ", ' thành thực thể HTML (&lt;, &gt;, &amp;...) và ngược lại để ngăn chặn lỗi hiển thị và lỗ hổng XSS.

Trạng thái công cụChạy trên trình duyệt của bạn
Xem trước

Dữ liệu đầu vào

Hoặc kéo & thả tệp bất kỳhoặc chọn tệp từ máy
.html, .txt, .md · tối đa 2.0 MB. Xử lý trực tiếp trên trình duyệt, không bao giờ tải lên máy chủ.

Dữ liệu đầu ra

Encode HTML before showing code as text, or decode entities back to readable characters.

Cách thức hoạt động

  1. Nhập dữ liệu của bạn

    Điền các giá trị cần thiết, dán văn bản hoặc tải lên tệp bạn muốn xử lý.

  2. Xem kết quả tức thì

    Hầu hết các công cụ cập nhật theo thời gian thực khi bạn nhập liệu; một số công cụ sử dụng một nút hành động duy nhất.

  3. Sử dụng kết quả

    Sao chép, tải xuống hoặc chia sẻ kết quả được tạo — bạn luôn có toàn quyền kiểm soát dữ liệu của mình.

Quyền riêng tư & xử lý dữ liệuChạy cục bộ 100% trên trình duyệt của bạn. Công cụ này không tải dữ liệu của bạn lên máy chủ.

Chuyển Đổi Thực Thể HTML là gì?

Convert characters that have special meaning in HTML into safe entities, or decode entity text back to readable characters.

TÌM HIỂU CÁCH HOẠT ĐỘNG CỦA CÔNG CỤ

How to encode and decode HTML entities

When to encode entities

Encode entities when you need to show code as text, paste snippets into a CMS field, or prevent characters like < and & from being interpreted as markup.

How to use it

  • Paste HTML, text, or entity-encoded content into the input box.
  • Choose Encode to escape special characters.
  • Choose Decode to turn entities back into readable text.
  • Copy the output when it looks right.

Common uses

  • Showing HTML snippets inside documentation.
  • Preparing safe text for template examples.
  • Cleaning copied content that contains visible entity codes.

Encoding example

Show a tag as text

Characters that would be interpreted by HTML are replaced with entities, including ampersands, angle brackets, quotes, and apostrophes.

<button title="Tom & Ana's"> -> &lt;button title=&quot;Tom &amp; Ana&#39;s&quot;&gt;

Entity notes

Entity encoding helps display HTML-looking text as text. In production apps, still rely on the framework or template engine's escaping rules.

Các Câu Hỏi Thường Gặp (FAQ)

What characters are encoded?

The tool encodes the characters most likely to break HTML text: &, <, >, double quotes, and apostrophes.

Can it decode numeric entities?

Yes. It supports common named entities and numeric decimal or hexadecimal entities.

Does encoding sanitize unsafe HTML?

No. It escapes text for display, but it is not a complete HTML sanitizer for untrusted markup.

Which named entities are decoded?

The named map covers amp, lt, gt, quot, apos, and #39. Numeric decimal and hexadecimal entities are decoded too.

Công Cụ Liên Quan