October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk2 min

' vs. ' in HTML: What’s the Difference?

' and ' both represent the same apostrophe in HTML. The difference is numeric versus named notation; quote attribute values to avoid delimiter conflicts.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

' and ' represent the same apostrophe character in HTML: U+0027. One is a decimal numeric character reference; the other is a named character reference. If an apostrophe appears in a name inside a single-quoted HTML attribute, the practical fix is usually to put the attribute value in double quotes.

What do ' and ' mean?

Both references represent U+0027, the ordinary apostrophe character. The difference is how the reference is written, not what character it represents:

Reference Type Character
' Decimal numeric character reference: the number after # is a decimal code point U+0027 apostrophe
' Named character reference U+0027 apostrophe

The WHATWG HTML Standard’s named-character-reference table maps apos; to U+0027. Its character-reference syntax defines decimal numeric references as &# followed by decimal digits and a semicolon. In HTML, both forms are interpreted as the same character.

Why does the apostrophe break the example?

Consider this markup:

<meta content='ronpat's' name='keywords'/>

The value of content starts with a single quote. The apostrophe in ronpat's is also a single quote, so it closes the value early. The remaining characters no longer form the intended attribute value.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
HTML and CSS: Design and Build Websites
  • HTML CSS Design and Build Web Sites
  • Comes with secure packaging
  • It can be a gift option

How should you write an attribute containing an apostrophe?

Use double quotes around the value

This is the simplest, clearest fix:

<meta content="ronpat's" name="keywords">

The apostrophe inside the value does not conflict with the double-quote delimiters. For ordinary HTML markup, double quotes are a common convention; the SitePoint discussion that raised this example recommended them as well, while noting that single quotes can appear inside a double-quoted value. The SitePoint thread dates from July 6, 2016.

Use a character reference when appropriate

You can also represent the apostrophe with a character reference inside the intended attribute value. For example, &#39; or &apos; represents that same apostrophe. The reference does not change the need to delimit the attribute correctly: choose quotes that let the parser identify the full value.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Why might one form be converted to the other?

A program that generates or rewrites HTML can choose to serialize an apostrophe as a numeric reference or as a named reference. Both notations represent the same character, so the choice may reflect that program’s output conventions rather than a difference in the text or its rendered meaning.

The SitePoint question mentions Blogger as a possibility, but the discussion does not establish which software performed the conversion or what settings it used. Without a reproducible example from that environment, the specific cause cannot be determined. The important distinction is that HTML parsing interprets the references, while the generating software chooses how to write the character in the markup.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Sale
Web Design with HTML, CSS, JavaScript and jQuery Set
  • Brand: Wiley
  • Set of 2 Volumes
  • A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.