' — Apostrophe

Code point 39 · U+0027 · markup-critical

' is the named character reference for the apostrophe, code point 39. Written as a decimal reference it is '; as a hexadecimal reference, '. All three resolve to the same glyph, and the choice between them is about what survives your toolchain rather than about meaning.

Character'
Named'
Decimal'
Hexadecimal'

Which form to write

Named references are readable and self-documenting, which is why hand-written markup uses them. Numeric references — decimal or hexadecimal — are unambiguous and immune to entity-table gaps, which is why generators, serialisers and sanitisers prefer them. HTML5 recognises the named form only in the HTML syntax, and browsers resolve any of the three identically at render time.

FormBytesSurvivesTypical producer
'6Any HTML5 parserHand-written templates
'5Every HTML and XML parserOlder escape libraries
'6Every HTML and XML parserModern serialisers

What this site's encoder does with it

Paste the apostrophe into the encoder and pick a style: with named selected the output is '. Note the fallback: the encoder only has named forms for the four markup-critical characters, so a character that does have a named entity still comes out as a hexadecimal reference here. That is deliberate — the output stays valid even when a downstream parser does not know the name.

This character is one of the handful that must always be escaped. Left raw inside text or an attribute it changes how the document is parsed rather than what it displays.

Mistakes worth avoiding

Questions about '

What is ' in decimal and hex?

Decimal ', hexadecimal '. All three reference code point 39 and render the same character, “'”.

Do I have to use the named form?

Nothing compels the named form. Numeric references work everywhere and survive editors that mangle entity names, which is why minifiers and escape tools emit them by default.

Which form does this site's encoder output for '?

It emits ' into the escaped output. Only &, <, > and " have named forms in the encoder, so every other character is written as a hexadecimal numeric reference even when a named entity exists.

Where does &apos; break?

It breaks in HTML 4, which never defined it. Any document parsed as HTML 4 or XHTML 1.0 without the HTML5 entity set will show the literal text ' instead of the character, so numeric ' is the portable choice.