Main Content

Special characters in HTML

Archive - Originally posted on "The Horse's Mouth" - 2013-03-09 17:43:35 - Graham Ellis

Which are the most commonly used special characters in an HTML stream? Totally unscientific, but here's a table of the ones that I've used in my 4000 or so blog articles thus far, the final column being a count of the number of occurrences.

   23204
• •2126
<1792
£ £502
&284
>95
° °8
© ©8
"7
é é6
€ €4
ñ ñ1
á á1


A couple of comments:

a)   is a non-breaking space. It's used to ensure that a space really shows up as a space and that multiple spaces don't get squished to one (vital with Python source!), and to ensure that two words that need to logically appear together really do appear together. That's very useful at the side of an image to stop a few words appearing, and then a long word that's too wide causes a big white space. By making the first few words into (in effect) one long word, the display is improved.

b) &lt; is necessary for the < symbol in text (and we use it a great deal in source code and HTML examples), so there are a large number of uses of this special code. However, it's not strictly necessary to replace > with &gt; so the count there is much lower.

There is a complete list of the special characters [here] - lots more accented characters, currency symbols and things like &para; for ¶, &reg; for ® and &plusmn; for ± which have never cropped up in previous blogs.