인코딩
HTML Entities Encode/Decode
HTML 엔티티 인코딩 및 디코딩 — 페이지에서 특수 문자를 안전하게 표시.
HTML entities are a way to write characters that would otherwise break markup (<, >, &) or have no keyboard key, as safe text sequences like < or &. This tool encodes and decodes such entities right in your browser.
How to use it
- Encode: paste text and characters like <, >, &, and quotes get replaced with their matching entities.
- Decode: paste HTML containing entities (&, ©, etc.) to see the plain text.
- Both named entities (&) and numeric ones (& or &) are supported.
Common uses
- Safely displaying user text (a comment, a message) on a page without risking broken markup or an injected script.
- Embedding HTML code samples in an article or documentation so the browser shows them as text instead of rendering them.
- Decoding content copied from another site where the characters arrived already entity-encoded.
Things to keep in mind
HTML entity escaping only protects against XSS via a page's text content — it does not protect a JavaScript context (innerHTML, eval) or href/src attributes containing unvalidated URLs.
Encode exactly at the point where text gets inserted into HTML, not ahead of time when saving to a database — otherwise the data gets mangled when reused outside an HTML context.
자주 묻는 질문
HTML 엔티티는 왜 필요한가요?
<, >, & 같은 문자는 HTML에서 태그나 엔티티의 시작으로 해석되기 때문에 사용자 입력이나 텍스트를 그대로 넣으면 마크업이 깨지거나 XSS 위험이 생길 수 있습니다. 엔티티로 인코딩하면 이런 문자를 안전하게 화면에 표시할 수 있습니다.
named entity(&)와 numeric entity(&)는 뭐가 다른가요?
&처럼 이름으로 표기하는 named entity와 & 또는 &처럼 문자 코드로 표기하는 numeric entity 둘 다 같은 문자를 나타냅니다. named entity는 가독성이 좋고, numeric entity는 이름이 정의되지 않은 문자에도 쓸 수 있습니다.
이 도구는 서버로 데이터를 전송하나요?
아니요. 인코딩과 디코딩 모두 브라우저 안에서 처리되며 입력한 텍스트는 서버로 전송되지 않습니다.
속성 안의 텍스트는 본문과 다르게 이스케이프해야 하나요?
기본 문자(<, >, &)는 똑같이 이스케이프하지만, 따옴표로 감싼 속성 안에서는 속성을 감싼 바로 그 종류의 따옴표를 추가로 이스케이프하는 것이 중요합니다 — 그렇지 않으면 값이 예상보다 일찍 "끊어질" 수 있습니다.
HTML 이스케이프가 모든 종류의 XSS를 막아주나요?
아니요. 가장 흔한 벡터인 텍스트를 HTML 콘텐츠에 삽입하는 방식은 막아주지만, JavaScript 컨텍스트를 통한 XSS(예: innerHTML 이후 코드 실행)나 검증되지 않은 href/src의 URL로부터는 보호하지 못합니다.