ASCII Character Set

HTML and XHTML documents use the standard 7-bit ASCII character set in their source. The first 31 characters in ASCII (not listed) are such device controls as backspace () and carriage return (
) and are not appropriate for use in HTML documents.

HTML 4.01 defines only four entities in this character range: less than (<, &lt;), greater than (<, &gt;), ampersand (&, &amp;), and quotation mark (", &quot;), that are necessary for escaping characters that may be interpreted as markup. XHTML also includes the &apos; entity that is included in every XML language. In XHTML documents, the ampersand symbol (&) must always be escaped in attribute values. For better compatibility with XML parsers, authors should use numerical character references instead of named character references for all other character entities.

Decimal

Hex

Entity

Symbol

Description

&#032;

&#x20;

  

Space

&#033;

&#x21;

 

!

Exclamation point

&#034;

&#x22;

&quot;

"

Quotation mark

&#035;

&#x23;

 

#

Octothorpe

&#036;

&#x24;

 

$

Dollar symbol

&#037;

&#x25;

 

%

Percent symbol

&#038;

&#x26;

&amp;

&

Ampersand

&#039;

&#x27;

XML/XHTML only: &apos;

'

Apostrophe (single quote)

&#040;

&#x28;

 

(

Left parenthesis

&#041;

&#x29;

 

)

Right parenthesis

&#042;

&#x2A;

 

*

Asterisk

&#043;

&#x2B;

 

+

Plus sign

&#044;

&#x2C;

 

,

Comma

&#045;

&#x2D;

 

-

Hyphen

&#046;

&#x2E;

 

.

Period

&#047;

Get Web Design in a Nutshell, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.