HTML・Polishing your text

Special characters (HTML entities)

Characters like <, &, and © that you can't just type, or that are hard to type. Let's learn how to display them properly on screen with the &lt; &amp; notation, called entity references.

“I want to write the < symbol in my text, but for some reason it won’t show up on screen…” — the thing is, in HTML, < and & are treated specially, as cues for tags. Write them directly and the browser gets the wrong idea: “oh, is a tag starting here?” The way to show such symbols properly as plain characters is the entity reference.

Why can’t you just write them?

The reason is simple: < is the start of a tag, and & is the start of an entity reference. When the browser sees these two, it braces itself: “is this a command?” So when you want to show them as ordinary characters, you swap in the code word to tell it “this is just a symbol.”

Commonly used entity references

Just these few are all you really need to remember.

Character to showHow to write itWhere the name comes from
<&lt;less than
>&gt;greater than
&&amp;ampersand
"&quot;quotation
©&copy;copyright
(a space that won’t break)&nbsp;non-breaking space

For example, say you want to show the literal way to write a “p tag” inside an article.

<p>A paragraph is written as &lt;p&gt;.</p>
&lt; and &gt; appear on screen as the < and > symbols, not as a tag.

Written this way, the screen shows A paragraph is written as <p>. with the symbols intact. Thanks to swapping in &lt; and &gt;, the browser didn’t mistake them for a tag.

You can show symbols and marks too

Beyond plain characters, you can also show symbols that aren’t on your keyboard. For the copyright mark you often see in footers, it’s like this.

<p>&copy; 2026 Shima</p>
Even though you wrote &copy; in the code, on screen it turns into the © mark just fine.

&copy; turns into ©. There are lots of other arrows and special marks available too.

You can also write them by number

Besides &name;, entity references also have a &#number; form. For ©, this gives the same result.

<p>&#169; 2026 Shima</p>
Even when you write the number &#169; instead of the name &copy;, the same © mark appears.
How to write itCharacter shown
&copy; (by name)©
&#169; (by number)©

The number points to a Unicode value — a character number shared worldwide. Names are easier to remember and read, so for everyday use a named form like &copy; is plenty. Just knowing “there’s also a way to write it by number” means you won’t be thrown off when you see it in someone else’s code.

Summary of this lesson

  1. < > & get special treatment. To show them as characters, use an entity reference
  2. &lt; &gt; &amp; — start with &, close with ;
  3. With UTF-8, Japanese and emoji stay as-is. Entity references are needed for mainly three characters

Let’s put a copyright in the <footer> of Shima’s page. You show the © symbol with &copy;.

<footer>
  <p>&copy; 2026 Shima</p>
</footer>

&copy; turns into ©, and the screen shows ”© 2026 Shima”. Now you can produce symbols that aren’t on your keyboard, using code words.

FAQ

Can I write entity references by number instead of by name?
Yes. There's also a form '&#number;', like &#169;, so you can produce symbols such as © using the number instead. When a character has a name you can remember, writing it by name is easier to read, so learning the name form first is plenty.
Why does copied text sometimes contain unfamiliar strings like &amp;?
When you copy text from another site, parts that were originally written as entity references can get pasted in as-is. If you spot a string that starts with & and ends with ;, you can recognize it as an entity reference.
What happens if I write an entity reference wrong?
Often it isn't converted, and a string like &lgt; shows up on screen as-is. Check that it starts with & and closes with ;, and that the name is spelled correctly.