|
HTML: ASCII Character Codes
The table below presents all ASCII characters with codes from 32-127 and 160-255.
The missing characters (0-27 and 128-159) are 'control characters' and
not normally suited for output in HTML. The 'Entity' column gives the
equivalent HTML character entity - where one exists.
If you're looking for a way to encode text - for protecting email links for example - you
can use this form to encode a short string:
For other types of encoding in JavaScript or PHP refer to the article
Escaping Special Characters.
HTML Character Codes and Entities
This table is dynamically generated.
| Decimal | Symbol | Entity | Octal | Hex |
| 32 | | | 40 | 20 |
| 33 | ! | | 41 | 21 |
| 34 | " | " | 42 | 22 |
| 35 | # | | 43 | 23 |
| 36 | $ | | 44 | 24 |
| 37 | % | | 45 | 25 |
| 38 | & | & | 46 | 26 |
| 39 | ' | | 47 | 27 |
| 40 | ( | | 50 | 28 |
| 41 | ) | | 51 | 29 |
| 42 | * | | 52 | 2A |
| 43 | + | | 53 | 2B |
| 44 | , | | 54 | 2C |
| 45 | - | | 55 | 2D |
| 46 | . | | 56 | 2E |
| 47 | / | | 57 | 2F |
| 48 | 0 | | 60 | 30 |
| 49 | 1 | | 61 | 31 |
| 50 | 2 | | 62 | 32 |
| 51 | 3 | | 63 | 33 |
| 52 | 4 | | 64 | 34 |
| 53 | 5 | | 65 | 35 |
| 54 | 6 | | 66 | 36 |
| 55 | 7 | | 67 | 37 |
| 56 | 8 | | 70 | 38 |
| 57 | 9 | | 71 | 39 |
| 58 | : | | 72 | 3A |
| 59 | ; | | 73 | 3B |
| 60 | < | < | 74 | 3C |
| 61 | = | | 75 | 3D |
| 62 | > | > | 76 | 3E |
| 63 | ? | | 77 | 3F |
| 64 | @ | | 100 | 40 |
| 65 | A | | 101 | 41 |
| 66 | B | | 102 | 42 |
| 67 | C | | 103 | 43 |
| 68 | D | | 104 | 44 |
| 69 | E | | 105 | 45 |
| 70 | F | | 106 | 46 |
| 71 | G | | 107 | 47 |
| 72 | H | | 110 | 48 |
| 73 | I | | 111 | 49 |
| 74 | J | | 112 | 4A |
| 75 | K | | 113 | 4B |
| 76 | L | | 114 | 4C |
| 77 | M | | 115 | 4D |
| 78 | N | | 116 | 4E |
| 79 | O | | 117 | 4F |
| 80 | P | | 120 | 50 |
| 81 | Q | | 121 | 51 |
| 82 | R | | 122 | 52 |
| 83 | S | | 123 | 53 |
| 84 | T | | 124 | 54 |
| 85 | U | | 125 | 55 |
| 86 | V | | 126 | 56 |
| 87 | W | | 127 | 57 |
| 88 | X | | 130 | 58 |
| 89 | Y | | 131 | 59 |
| 90 | Z | | 132 | 5A |
| 91 | [ | | 133 | 5B |
| 92 | \ | | 134 | 5C |
| 93 | ] | | 135 | 5D |
| 94 | ^ | | 136 | 5E |
| 95 | _ | | 137 | 5F |
| 96 | ` | | 140 | 60 |
| 97 | a | | 141 | 61 |
| 98 | b | | 142 | 62 |
| 99 | c | | 143 | 63 |
| 100 | d | | 144 | 64 |
| 101 | e | | 145 | 65 |
| 102 | f | | 146 | 66 |
| 103 | g | | 147 | 67 |
| 104 | h | | 150 | 68 |
| 105 | i | | 151 | 69 |
| 106 | j | | 152 | 6A |
| 107 | k | | 153 | 6B |
| 108 | l | | 154 | 6C |
| 109 | m | | 155 | 6D |
| 110 | n | | 156 | 6E |
| 111 | o | | 157 | 6F |
| 112 | p | | 160 | 70 |
| 113 | q | | 161 | 71 |
| 114 | r | | 162 | 72 |
| 115 | s | | 163 | 73 |
| 116 | t | | 164 | 74 |
| 117 | u | | 165 | 75 |
| 118 | v | | 166 | 76 |
| 119 | w | | 167 | 77 |
| 120 | x | | 170 | 78 |
| 121 | y | | 171 | 79 |
| 122 | z | | 172 | 7A |
| 123 | { | | 173 | 7B |
| 124 | | | | 174 | 7C |
| 125 | } | | 175 | 7D |
| 126 | ~ | | 176 | 7E |
| 127 | | | 177 | 7F |
| Decimal | Symbol | Entity | Octal | Hex |
| 160 | | | 240 | A0 |
| 161 | ¡ | ¡ | 241 | A1 |
| 162 | ¢ | ¢ | 242 | A2 |
| 163 | £ | £ | 243 | A3 |
| 164 | ¤ | ¤ | 244 | A4 |
| 165 | ¥ | ¥ | 245 | A5 |
| 166 | ¦ | ¦ | 246 | A6 |
| 167 | § | § | 247 | A7 |
| 168 | ¨ | ¨ | 250 | A8 |
| 169 | © | © | 251 | A9 |
| 170 | ª | ª | 252 | AA |
| 171 | « | « | 253 | AB |
| 172 | ¬ | ¬ | 254 | AC |
| 173 | | ­ | 255 | AD |
| 174 | ® | ® | 256 | AE |
| 175 | ¯ | ¯ | 257 | AF |
| 176 | ° | ° | 260 | B0 |
| 177 | ± | ± | 261 | B1 |
| 178 | ² | ² | 262 | B2 |
| 179 | ³ | ³ | 263 | B3 |
| 180 | ´ | ´ | 264 | B4 |
| 181 | µ | µ | 265 | B5 |
| 182 | ¶ | ¶ | 266 | B6 |
| 183 | · | · | 267 | B7 |
| 184 | ¸ | ¸ | 270 | B8 |
| 185 | ¹ | ¹ | 271 | B9 |
| 186 | º | º | 272 | BA |
| 187 | » | » | 273 | BB |
| 188 | ¼ | ¼ | 274 | BC |
| 189 | ½ | ½ | 275 | BD |
| 190 | ¾ | ¾ | 276 | BE |
| 191 | ¿ | ¿ | 277 | BF |
| 192 | À | À | 300 | C0 |
| 193 | Á | Á | 301 | C1 |
| 194 | Â | Â | 302 | C2 |
| 195 | Ã | Ã | 303 | C3 |
| 196 | Ä | Ä | 304 | C4 |
| 197 | Å | Å | 305 | C5 |
| 198 | Æ | Æ | 306 | C6 |
| 199 | Ç | Ç | 307 | C7 |
| 200 | È | È | 310 | C8 |
| 201 | É | É | 311 | C9 |
| 202 | Ê | Ê | 312 | CA |
| 203 | Ë | Ë | 313 | CB |
| 204 | Ì | Ì | 314 | CC |
| 205 | Í | Í | 315 | CD |
| 206 | Î | Î | 316 | CE |
| 207 | Ï | Ï | 317 | CF |
| 208 | Ð | Ð | 320 | D0 |
| 209 | Ñ | Ñ | 321 | D1 |
| 210 | Ò | Ò | 322 | D2 |
| 211 | Ó | Ó | 323 | D3 |
| 212 | Ô | Ô | 324 | D4 |
| 213 | Õ | Õ | 325 | D5 |
| 214 | Ö | Ö | 326 | D6 |
| 215 | × | × | 327 | D7 |
| 216 | Ø | Ø | 330 | D8 |
| 217 | Ù | Ù | 331 | D9 |
| 218 | Ú | Ú | 332 | DA |
| 219 | Û | Û | 333 | DB |
| 220 | Ü | Ü | 334 | DC |
| 221 | Ý | Ý | 335 | DD |
| 222 | Þ | Þ | 336 | DE |
| 223 | ß | ß | 337 | DF |
| 224 | à | à | 340 | E0 |
| 225 | á | á | 341 | E1 |
| 226 | â | â | 342 | E2 |
| 227 | ã | ã | 343 | E3 |
| 228 | ä | ä | 344 | E4 |
| 229 | å | å | 345 | E5 |
| 230 | æ | æ | 346 | E6 |
| 231 | ç | ç | 347 | E7 |
| 232 | è | è | 350 | E8 |
| 233 | é | é | 351 | E9 |
| 234 | ê | ê | 352 | EA |
| 235 | ë | ë | 353 | EB |
| 236 | ì | ì | 354 | EC |
| 237 | í | í | 355 | ED |
| 238 | î | î | 356 | EE |
| 239 | ï | ï | 357 | EF |
| 240 | ð | ð | 360 | F0 |
| 241 | ñ | ñ | 361 | F1 |
| 242 | ò | ò | 362 | F2 |
| 243 | ó | ó | 363 | F3 |
| 244 | ô | ô | 364 | F4 |
| 245 | õ | õ | 365 | F5 |
| 246 | ö | ö | 366 | F6 |
| 247 | ÷ | ÷ | 367 | F7 |
| 248 | ø | ø | 370 | F8 |
| 249 | ù | ù | 371 | F9 |
| 250 | ú | ú | 372 | FA |
| 251 | û | û | 373 | FB |
| 252 | ü | ü | 374 | FC |
| 253 | ý | ý | 375 | FD |
| 254 | þ | þ | 376 | FE |
| 255 | ÿ | ÿ | 377 | FF |
For details on non-ASCII characters supported in HTML follow the link
under References below.
So why do we need all these different ways of referencing the same
characters? The Decimal values are rarely used, but
Octal codes turn up in various programming languages and the
Hex values in URL-encoded strings (%20 represents a space for
example). In HTML content the Symbol is used except where a proper
Character Entity is available.
For more information on encoding special characters see the related
article linked below.
Common Windows-1251 Character Codes
If your data has been corrupted with Windows-specific characters such
as: smart quotes, ellipses, dashes and non-breaking spaces, the
following list might be useful:
| Decimal | Octal | Description | Plain Text Alternative |
| 133 | \205 | ELLIPSIS | ... |
| 145 | \221 | HIGH 6 SINGLE QUOTE | ' |
| 146 | \222 | HIGH 9 SINGLE QUOTE | ' |
| 147 | \223 | HIGH 6 DOUBLE QUOTE | " |
| 148 | \224 | HIGH 9 DOUBLE QUOTE | " |
| 149 | \225 | LARGE CENTERED DOT | * |
| 150 | \226 | EN DASH | - |
| 151 | \227 | EM DASH | - or -- |
| 160 | \240 | NO-BREAK SPACE | (space) |
Other replacement values are also possible including various valid
HTML entities (see above) or multibyte characters.
The reason for the \ in front of the Octal code for these
characters is so that we can use them in regular expressions as shown
here:
$output = mb_eregi_replace("\205", "...", $input);
You might find this necessary when converting data to UTF-8 or other
multibyte character formats. For non-multibyte formats you can use the
regular preg_replace or ereg_replace functions instead
as there's no danger of corrupting the text by accidentally replacing
one byte of a multibyte character.
Related Articles
References
[Back to HTML]
|