Comments, Entities & Symbols

Comments let you leave notes in your HTML that browsers ignore. Character entities let you show characters that would otherwise be read as HTML — like < — and symbols that are hard to type. With UTF-8, you can also use any emoji or script directly.

Comments

Try it yourself
Result

Anything between <!-- and --> is ignored. Use comments to label sections of long pages, explain unusual code, or temporarily hide something.

Warning: comments are invisible on the page but anyone can read them with "View source". Never put passwords, private notes or internal details in HTML comments.

Why entities exist

The characters <, > and & have special meaning in HTML. To display them as text, write them as character entities:

Try it yourself
Result

Common entities

CharacterNamed entityNumericNotes
<&lt;&#60;Less than
>&gt;&#62;Greater than
&&amp;&#38;Ampersand
"&quot;&#34;Inside attribute values
(space)&nbsp;&#160;Non-breaking space
©&copy;&#169;Copyright
—&mdash;&#8212;Em dash
€ £ ¥&euro; &pound; &yen;Currencies
→ ×&rarr; &times;Arrows, maths

Every character also has a numeric form: decimal (&#169;) or hexadecimal (&#xA9;), based on its Unicode code point.

Non-breaking spaces

Try it yourself
Result

&nbsp; joins two words so they never wrap onto separate lines — useful for numbers with units, initials and short phrases. It isn't a tool for adding spacing; use CSS for that.

UTF-8, symbols and emoji

With <meta charset="utf-8"> in your head, you can type any character directly — accents, other scripts, symbols and emoji:

Try it yourself
Result

Typing characters directly is usually clearer than entities. You only need entities for <, & and quotes in attributes, plus invisible characters like &nbsp;.

Accessibility: screen readers announce emoji and symbols by name ("party popper"). Decorative symbols can be hidden from them by wrapping in <span aria-hidden="true">; meaningful ones should have a text equivalent.

Try it yourself

Try it yourself
Result