How to write any symbol in HTML, CSS and code

In a file that is served as UTF-8 you can paste the character itself and it will work. Escapes exist for the cases where you cannot trust the encoding, where the character is invisible in an editor, or where the syntax forbids it.

HTML: named, decimal or hex

°, ° and ° are the same character. Only a few hundred have names; every character has the numeric forms. Five characters MUST be escaped in HTML rather than pasted: &, <, >, " and '.

Declare the encoding first

<meta charset="utf-8"> as the first thing in the head. Without it a browser may read your bytes as Windows-1252 and a degree sign arrives as °. That mojibake is a reading error, not a damaged file: the bytes are fine and setting the encoding restores them.

CSS, JavaScript, Python

CSS wants a backslash and hex with no semicolon inside a string: content: "\00B0". JavaScript takes "\u00B0", or "\u{1F600}" above the basic plane. Python takes "\u00b0" and chr(176).

LaTeX

Text mode wants a command: \textdegree, \pounds, \S. Maths mode has its own: $\pm$, $\times$, $\sqrt{x}$. With XeLaTeX or LuaLaTeX and a Unicode font you can type the character directly instead.

The characters people ask about most

Most searched for in HTML, CSS and code, by measured volume
CharacterName HTML entity
°Degree Symbol°
±Plus-Minus±
★Black Star★
→Right Arrow→
*Asterisk&#42;
€Euro Sign€
≥Greater Than or Equal≥
>Greater-Than Sign&gt;
^Caret&#94;
%Percent Sign&#37;
·Middle Dot·
`Grave Accent&#96;

Every other place you might be typing, or a page for each character.

Namepoint at any character
Unicode—
Windows—
Mac—
HTML—
COPIED