How do you escape special characters in html?

In HTML, XHTML, or XML, you can use a character escape to represent any Unicode character using only ASCII letters. Character escapes used in markup include numeric character references (NCRs) and named character references. 

A numeric character reference in hexadecimal format. The hex number is case-insensitive, and all numeric character references begin with &# and conclude with ;.

Escapes are very useful for representing characters that are not apparent or are ambiguous. 

Numeric or named character references, as well as CSS escapes, can be used to represent characters in HTML style attribute. The style element HTML can not contain numeric or named character references. The same goes for an external style sheet. 

You should always try to employ an encoding allowing you to represent characters in their natural form. 

If the entities are defined outside of your document and the tools processing the XML do not access the external files, using named characters may become troublesome. Characters will not be used to substitute entity references in such circumstances.

Consequently, if you need to employ escapes in web development, it’s safer to use numeric character references.

In the table below you can find the complete list of the most useful HTML escape characters. Let us know if you use something we didn’t cover so we can update our list.

Number Symbol Entity Name Code Description
9 Tab Tab
10 New Line New Line
32 Space   Space
33 ! ! Exclamation mark
34 " " Quotation mark
35 # # Number sign
36 $ $ Dollar sign
37 % % Percent sign
38 & & & Ampersand
39 ' Apostrophe
40 ( ( Opening/Left Parenthesis
41 ) ) Closing/Right Parenthesis
42 * * Asterisk
43 + + Plus sign
44 , , Comma
45 - Hyphen
46 . . Period
47 / / Slash
48 0 0 Digit 0
49 1 1 Digit 1
50 2 2 Digit 2
51 3 3 Digit 3
52 4 4 Digit 4
53 5 5 Digit 5
54 6 6 Digit 6
55 7 7 Digit 7
56 8 8 Digit 8
57 9 9 Digit 9
58 : : Colon
59 ; ; Semicolon
60 < < < Less-than
61 = = Equals sign
62 > > > Greater than
63 ? ? Question mark
64 @ @ At sign
65 A A Uppercase A
66 B B Uppercase B
67 C C Uppercase C
68 D D Uppercase D
69 E E Uppercase E
70 F F Uppercase F
71 G G Uppercase G
72 H H Uppercase H
73 I I Uppercase I
74 J J Uppercase J
75 K K Uppercase K
76 L L Uppercase L
77 M M Uppercase M
78 N N Uppercase N
79 O O Uppercase O
80 P P Uppercase P
81 Q Q Uppercase Q
82 R R Uppercase R
83 S S Uppercase S
84 T T Uppercase T
85 U U Uppercase U
86 V V Uppercase V
87 W W Uppercase W
88 X X Uppercase X
89 Y Y Uppercase Y
90 Z Z Uppercase Z
91 [ [ Opening/Left square bracket
92 \ \ Backslash
93 ] ] Closing/Right square bracket
94 ^ ^ Caret
95 _ _ Underscore
96 ` ` Grave accent
97 a a Lowercase a
98 b b Lowercase b
99 c c Lowercase c
100 d d Lowercase d
101 e e Lowercase e
102 f f Lowercase f
103 g g Lowercase g
104 h h Lowercase h
105 i i Lowercase i
106 j j Lowercase j
107 k k Lowercase k
108 l l Lowercase l
109 m m Lowercase m
110 n n Lowercase n
111 o o Lowercase o
112 p p Lowercase p
113 q q Lowercase q
114 r r Lowercase r
115 s s Lowercase s
116 t t Lowercase t
117 u u Lowercase u
118 v v Lowercase v
119 w w Lowercase w
120 x x Lowercase x
121 y y Lowercase y
122 z z Lowercase z
123 { { Opening/Left curly brace
124 | | Vertical bar
125 } } Closing/Right curly brace
126 ~ ~ Tilde
128 Euro sign
130 Punctuation mark
131 ƒ ƒ Florin sign
132 Quotation mark
133 Horizontal ellipsis
134 Dagger
135 Double dagger
136 ˆ ˆ Circumflex
137 Per-mille
138 Š Š Latin capital letter s with caron
139 Single left angle quotation
140 ΠΠUppercase ligature OE
142 Ž Ž Latin capital letter z with caron
145 Opening single quotation mark
146 Closing single quotation mark
147 Opening double quotation mark
148 Closing double quotation mark
149 Bullet
150 En dash
151 Em dash
152 ˜ ˜ Tilde
153 Trademark
154 š š Latin small letter s with caron
155 Single right angle quotation
156 œ œ Lowercase ligature OE
158 ž ž Latin small letter z with caron
159 Ÿ Ÿ Latin capital letter y with diaeresis
160 Non-breaking space     Non-breaking space
161 ¡ ¡ ¡ Inverted exclamation mark
162 ¢ ¢ ¢ Cent
163 £ £ £ Pound
164 ¤ ¤ ¤ Currency
165 ¥ ¥ ¥ Yen
166 ¦ ¦ ¦ Broken vertical bar
167 § § § Section
168 ¨ ¨ ¨ Spacing diaeresis
169 © © © Copyright
170 ª ª ª Feminine ordinal indicator
171 « « « Opening/Left angle quotation mark
172 ¬ ¬ ¬ Negation
173 ­Soft hyphen ­ ­ Soft hyphen
174 ® ® ® Registered trademark
175 ¯ ¯ ¯ Spacing macron
176 ° ° ° Degree
177 ± ± ± Plus or minus
178 ² ² ² Superscript 2
179 ³ ³ ³ Superscript 3
180 ´ ´ ´ Spacing acute
181 µ µ µ Micro
182 Paragraph
182 · ˙ · Dot
184 ¸ ¸ ¸ Spacing cedilla
185 ¹ ¹ ¹ Superscript 1
186 º º º Masculine ordinal indicator
187 » » » Closing/Right angle quotation mark
188 ¼ ¼ ¼ Fraction 1/4
189 ½ ½ ½ Fraction 1/2
190 ¾ ¾ ¾ Fraction 3/4
191 ¿ ¿ ¿ Inverted question mark
192 À À À Capital a with grave accent
193 Á Á Á Capital a with acute accent
194 Â Â Â Capital a with circumflex accent
195 Ã Ã Ã Capital a with tilde
196 Ä Ä Ä Capital a with umlaut
197 Å Å Å Capital a with ring
198 Æ Æ Æ Capital ae
199 Ç Ç Ç Capital c with cedilla
200 È È È Capital e with grave accent
201 É É É Capital e with acute accent
202 Ê Ê Ê Capital e with circumflex accent
203 Ë Ë Ë Capital e with umlaut
204 Ì Ì Ì Capital i with grave accent
205 Í Í Í Capital i with accute accent
206 Î Î Î Capital i with circumflex accent
207 Ï Ï Ï Capital i with umlaut
208 Ð Ð Ð Capital eth (Icelandic)
209 Ñ Ñ Ñ Capital n with tilde
210 Ò Ò Ò Capital o with grave accent
211 Ó Ó Ó Capital o with accute accent
212 Ô Ô Ô Capital o with circumflex accent
213 Õ Õ Õ Capital o with tilde
214 Ö Ö Ö Capital o with umlaut
215 × × × Multiplication
216 Ø Ø Ø Capital o with slash
217 Ù Ù Ù Capital u with grave accent
218 Ú Ú Ú Capital u with acute accent
219 Û Û Û Capital u with circumflex accent
220 Ü Ü Ü Capital u with umlaut
221 Ý Ý Ý Capital y with acute accent
222 Þ Þ Þ Capital thorn (Icelandic)
223 ß ß ß Lowercase sharp s (German)
224 à à à Lowercase a with grave accent
225 á á á Lowercase a with acute accent
226 â â â Lowercase a with circumflex accent
227 ã ã ã Lowercase a with tilde
228 ä ä ä Lowercase a with umlaut
229 å å å Lowercase a with ring
230 æ æ æ Lowercase ae
231 ç ç ç Lowercase c with cedilla
232 è è è Lowercase e with grave accent
233 é é é Lowercase e with acute accent
234 ê ê ê Lowercase e with circumflex accent
235 ë ë ë Lowercase e with umlaut
236 ì ì ì Lowercase i with grave accent
237 í í í Lowercase i with acute accent
238 î î î Lowercase i with circumflex accent
239 ï ï ï Lowercase i with umlaut
240 ð ð ð Lowercase eth (Icelandic)
241 ñ ñ ñ Lowercase n with tilde
242 ò ò ò Lowercase o with grave accent
243 ó ó ó Lowercase o with acute accent
244 ô ô ô Lowercase o with circumflex accent
245 õ õ õ Lowercase o with tilde
246 ö ö ö Lowercase o with umlaut
247 ÷ ÷ ÷ Divide
248 ø ø ø Lowercase o with slash
249 ù ù ù Lowercase u with grave accent
250 ú ú ú Lowercase u with acute accent
251 û û û Lowercase u with circumflex accent
252 ü ü ü Lowercase u with umlaut
253 ý ý ý Lowercase y with acute accent
254 þ þ þ Lowercase thorn (Icelandic)
255 ÿ ÿ ÿ Lowercase y with umlaut
256 Ā Ā Ā Latin capital letter a with macron
257 ā ā ā Latin small letter a with macron
258 Ă Ă Ă Latin capital letter a with breve
259 ă ă ă Latin small letter a with breve
260 Ą Ą Ą Latin capital letter a with ogonek
261 ą ą ą Latin small letter a with ogonek
262 Ć Ć Ć Latin capital letter c with acute
263 ć ć ć Latin small letter c with acute
264 Ĉ Ĉ Ĉ Latin capital letter c with circumflex
265 ĉ ĉ ĉ Latin small letter c with circumflex
266 Ċ Ċ Ċ Latin capital letter c with dot above
267 ċ ċ ċ Latin small letter c with dot above
268 Č Č Č Latin capital letter c with caron
269 č č č Latin small letter c with caron
270 Ď Ď Ď Latin capital letter d with caron
271 ď ď ď Latin small letter d with caron
272 Đ Đ Đ Latin capital letter d with stroke
273 đ đ đ Latin small letter d with stroke
274 Ē Ē Ē Latin capital letter e with macron
275 ē ē ē Latin small letter e with macron
276 Ĕ &Ebreve; Ĕ Latin capital letter e with breve
277 ĕ &ebreve; ĕ Latin small letter e with breve
278 Ė Ė Ė Latin capital letter e with dot above
279 ė ė ė Latin small letter e with dot above
280 Ę Ę Ę Latin capital letter e with ogonek
281 ę ę ę Latin small letter e with ogonek
282 Ě Ě Ě Latin capital letter e with caron
283 ě ě ě Latin small letter e with caron
284 Ĝ Ĝ Ĝ Latin capital letter g with circumflex
285 ĝ ĝ ĝ Latin small letter g with circumflex
286 Ğ Ğ Ğ Latin capital letter g with breve
287 ğ ğ ğ Latin small letter g with breve
288 Ġ Ġ Ġ Latin capital letter g with dot above
289 ġ ġ ġ Latin small letter g with dot above
290 Ģ Ģ Ģ Latin capital letter g with cedilla
291 ģ &gcedil; ģ Latin small letter g with cedilla
292 Ĥ Ĥ Ĥ Latin capital letter h with circumflex
293 ĥ ĥ ĥ Latin small letter h with circumflex
294 Ħ Ħ Ħ Latin capital letter h with stroke
295 ħ ħ ħ Latin small letter h with stroke
296 Ĩ Ĩ Ĩ Latin capital letter I with tilde
297 ĩ ĩ ĩ Latin small letter I with tilde
298 Ī Ī Ī Latin capital letter I with macron
299 ī ī ī Latin small letter I with macron
300 Ĭ &Ibreve; Ĭ Latin capital letter I with breve
301 ĭ &ibreve; ĭ Latin small letter I with breve
302 Į Į Į Latin capital letter I with ogonek
303 į į į Latin small letter I with ogonek
304 İ İ İ Latin capital letter I with dot above
305 ı ı ı ı Latin small letter dotless I
306 IJ IJ IJ Latin capital ligature ij
307 ij ij ij Latin small ligature ij
308 Ĵ Ĵ Ĵ Latin capital letter j with circumflex
309 ĵ ĵ ĵ Latin small letter j with circumflex
310 Ķ Ķ Ķ Latin capital letter k with cedilla
311 ķ ķ ķ Latin small letter k with cedilla
312 ĸ ĸ ĸ Latin small letter kra
313 Ĺ Ĺ Ĺ Latin capital letter l with acute
314 ĺ ĺ ĺ Latin small letter l with acute
315 Ļ Ļ Ļ Latin capital letter l with cedilla
316 ļ ļ ļ Latin small letter l with cedilla
317 Ľ Ľ Ľ Latin capital letter l with caron
318 ľ ľ ľ Latin small letter l with caron
319 Ŀ Ŀ Ŀ Latin capital letter l with middle dot
320 ŀ ŀ ŀ Latin small letter l with middle dot
321 Ł Ł Ł Latin capital letter l with stroke
322 ł ł ł Latin small letter l with stroke
323 Ń Ń Ń Latin capital letter n with acute
324 ń ń ń Latin small letter n with acute
325 Ņ Ņ Ņ Latin capital letter n with cedilla
326 ņ ņ ņ Latin small letter n with cedilla
327 Ň Ň Ň Latin capital letter n with caron
328 ň ň ň Latin small letter n with caron
329 ʼn ʼn ʼn Latin small letter n preceded by apostrophe
330 Ŋ Ŋ Ŋ Latin capital letter eng
331 ŋ ŋ ŋ Latin small letter eng
332 Ō Ō Ō Latin capital letter o with macron
333 ō ō ō Latin small letter o with macron
334 Ŏ &Obreve; Ŏ Latin capital letter o with breve
335 ŏ &obreve; ŏ Latin small letter o with breve
336 Ő Ő Ő Latin capital letter o with double acute
337 ő ő ő Latin small letter o with double acute
338 ΠΠΠUppercase ligature OE
339 œ œ œ Lowercase ligature OE
340 Ŕ Ŕ Ŕ Latin capital letter r with acute
341 ŕ ŕ ŕ Latin small letter r with acute
342 Ŗ Ŗ Ŗ Latin capital letter r with cedilla
343 ŗ ŗ ŗ Latin small letter r with cedilla
344 Ř Ř Ř Latin capital letter r with caron
345 ř ř ř Latin small letter r with caron
346 Ś Ś Ś Latin capital letter s with acute
347 ś ś ś Latin small letter s with acute
348 Ŝ Ŝ Ŝ Latin capital letter s with circumflex
349 ŝ ŝ ŝ Latin small letter s with circumflex
350 Ş Ş Ş Latin capital letter s with cedilla
351 ş ş ş Latin small letter s with cedilla
352 Š Š Š Uppercase S with caron
353 š š š Lowercase S with caron
354 Ţ Ţ Ţ Latin capital letter t with cedilla
355 ţ ţ ţ Latin small letter t with cedilla
356 Ť Ť Ť Latin capital letter t with caron
357 ť ť ť Latin small letter t with caron
358 Ŧ Ŧ Ŧ Latin capital letter t with stroke
359 ŧ ŧ ŧ Latin small letter t with stroke
360 Ũ Ũ Ũ Latin capital letter u with tilde
361 ũ ũ ũ Latin small letter u with tilde
362 Ū Ū Ū Latin capital letter u with macron
363 ū ū ū Latin small letter u with macron
364 Ŭ Ŭ Ŭ Latin capital letter u with breve
365 ŭ ŭ ŭ Latin small letter u with breve
366 Ů Ů Ů Latin capital letter u with ring above
367 ů ů ů Latin small letter u with ring above
368 Ű Ű Ű Latin capital letter u with double acute
369 ű ű ű Latin small letter u with double acute
370 Ų Ų Ų Latin capital letter u with ogonek
371 ų ų ų Latin small letter u with ogonek
372 Ŵ Ŵ Ŵ Latin capital letter w with circumflex
373 ŵ ŵ ŵ Latin small letter w with circumflex
374 Ŷ Ŷ Ŷ Latin capital letter y with circumflex
375 ŷ ŷ ŷ Latin small letter y with circumflex
376 Ÿ Ÿ Ÿ Capital Y with diaeres
402 ƒ ƒ ƒ Lowercase with hook
710 ˆ ˆ ˆ Circumflex accent
732 ˜ ˜ ˜ Tilde
913 Α Α Α Alpha
914 Β Β Β Beta
915 Γ Γ Γ Gamma
916 Δ Δ Δ Delta
917 Ε Ε Ε Epsilon
918 Ζ Ζ Ζ Zeta
919 Η Η Η Eta
920 Θ Θ Θ Theta
921 Ι Ι Ι Iota
922 Κ Κ Κ Kappa
923 Λ Λ Λ Lambda
924 Μ Μ Μ Mu
925 Ν Ν Ν Nu
926 Ξ Ξ Ξ Xi
927 Ο Ο Ο Omicron
928 Π Π Π Pi
929 Ρ Ρ Ρ Rho
931 Σ Σ Σ Sigma
932 Τ Τ Τ Tau
933 Υ Υ Υ Upsilon
934 Φ Φ Φ Phi
935 Χ Χ Χ Chi
936 Ψ Ψ Ψ Psi
937 Ω Ω Ω Omega
945 α α α alpha
946 β β β beta
947 γ γ γ gamma
948 δ δ δ delta
949 ε ε ε epsilon
950 ζ ζ ζ zeta
951 η η η eta
952 θ θ θ theta
953 ι ι ι iota
954 κ κ κ kappa
955 λ λ λ lambda
956 μ μ μ mu
957 ν ν ν nu
958 ξ ξ ξ xi
959 ο ο ο omicron
960 π π π pi
961 ρ ρ ρ rho
962 ς ς ς sigmaf
963 σ σ σ sigma
964 τ τ τ tau
965 υ υ υ upsilon
966 φ φ φ phi
967 χ χ χ chi
968 ψ ψ ψ psi
969 ω ω ω omega
977 ϑ ϑ ϑ Theta symbol
978 ϒ ϒ ϒ Upsilon symbol
982 ϖ ϖ ϖ Pi symbol
8194 En space En space
8195 Em space Em space
8201 Thin space Thin space
8204 Zero width non-joiner Zero width non-joiner
8205 Zero width joiner Zero width joiner
8206 Left-to-right mark Left-to-right mark
8207 Right-to-left mark Right-to-left mark
8211 En dash
8212 Em dash
8216 Left single quotation mark
8217 Right single quotation mark
8218 Single low-9 quotation mark
8220 Left double quotation mark
8221 Right double quotation mark
8222 Double low-9 quotation mark
8224 Dagger
8225 Double dagger
8226 Bullet
8230 Horizontal ellipsis
8240 Per mille
8242 Minutes (Degrees)
8243 Seconds (Degrees)
8249 Single left angle quotation
8250 Single right angle quotation
8254 Overline
8364 Euro
8482 Trademark
8592 Left arrow
8593 Up arrow
8594 Right arrow
8595 Down arrow
8596 Left right arrow
8629 Carriage return arrow
8704 For all
8706 Part
8707 Exist
8709 Empty
8711 Nabla
8712 Is in
8713 Not in
8715 Ni
8719 Product
8721 Sum
8722 Minus
8727 Asterisk (Lowast)
8730 Square root
8733 Proportional to
8734 Infinity
8736 Angle
8743 And
8744 Or
8745 Cap
8746 Cup
8747 Integral
8756 Therefore
8764 Similar to
8773 Congurent to
8776 Almost equal
8800 Not equal
8801 Equivalent
8804 Less or equal
8805 Greater or equal
8834 Subset of
8835 Superset of
8836 Not subset of
8838 Subset or equal
8839 Superset or equal
8853 Circled plus
8855 Circled times
8869 Perpendicular
8901 Dot operator
8968 Left ceiling
8969 Right ceiling
8970 Left floor
8971 Right floor
9674 Lozenge
9824 Spade
9827 Club
9829 Heart
9830 Diamond

What is the escape character in HTML?

CSS represents escaped characters in a different way. Escapes start with a backslash followed by the hexadecimal number that represents the character's hexadecimal Unicode code point value. If there is a following character that is not in the range A–F, a–f or 0–9, that is all you need.

How do you escape special characters?

Escape Characters Use the backslash character to escape a single character or symbol. Only the character immediately following the backslash is escaped. Note: If you use braces to escape an individual character within a word, the character is escaped, but the word is broken into three tokens.

How do you escape a tag in HTML?

Escape characters will always begin with the ampersand symbol (&) and end with a semicolon symbol (;). The characters in between the ampersand and semicolon make up the specific code name or number for a particular character.

How do you escape an apostrophe in HTML?

The apostrophe sign is one of them. We can use the entity number ’ to escape the apostrophe sign in HTML. We can also use the entity name ’ , which is equivalent to the entity number ’ . What's more, we can even use the entity number ’ to escape the apostrophe sign.