HTML entities for curly quotes “ ” ‘ ’

“ ” / ‘ ’

“ and ” are the HTML entities for the curly double quotes “ and ”, and ‘ and ’ for the single quotes ‘ and ’. ’ is also the typographic apostrophe.

“  U+201C  LEFT DOUBLE QUOTATION MARK    “   “   “   E2 80 9C
”  U+201D  RIGHT DOUBLE QUOTATION MARK   ”   ”   ”   E2 80 9D
‘  U+2018  LEFT SINGLE QUOTATION MARK    ‘   ‘   ‘   E2 80 98
’  U+2019  RIGHT SINGLE QUOTATION MARK   ’   ’   ’   E2 80 99

HTML5 adds long aliases such as “ and ’, which browsers read and JSX doesn’t. Encoding a sentence gives:

“Quoted,” she said. It’s ‘fine’.

The apostrophe

The Unicode Standard prefers U+2019 for the apostrophe, so It’s takes ’, the same character as a closing single quote. The straight ' (U+0027) is the typewriter form; when it must be escaped in HTML, it’s ', which is what this tool writes. Abbreviated years trip up smart-quote software: ’90s starts with an apostrophe, not the opening quote ‘.

Straight quotes in code

Code, JSON, shell commands and attribute values need the straight " and '. A command copied from a page that curled its quotes fails, because “ isn’t a string delimiter in JavaScript, Python or a shell, and JSON.parse('{“a”: 1}') throws. Put code in <code> or <pre>; typographers such as SmartyPants leave those alone.

Word documents pasted into old pages left &#147;, &#148;, &#145; and &#146; behind. The HTML standard reads them through Windows-1252 as “ ” ‘ ’ and reports parse errors; this tool decodes them the same way. Write the named references or the characters themselves instead.

<q> and other languages

<q> adds the quotation marks itself, from the CSS quotes property, so the markup holds none:

<p lang="de">Er sagte <q>Hallo</q>.</p>
:lang(de) q { quotes: "\201E" "\201C" "\201A" "\2018"; }    /* „Hallo“ */

German opens with &bdquo; („) and closes with &ldquo; (“); French uses &laquo; and &raquo; (« »).

JSX and Markdown

JSX decodes &ldquo;, &rdquo;, &lsquo; and &rsquo; in text. eslint-plugin-react’s react/no-unescaped-entities rule flags a raw " or ' in JSX text and suggests these entities, or &quot; and &apos;. In braces it’s JavaScript: write {'\u201C'} or the character.

CommonMark keeps straight quotes straight. Typographers curl them: markdown-it with typographer on, and Astro’s smartypants option, which is on by default. Both leave code spans alone.

Try it in the HTML Entity Encoder & Decoder

Encoded

5 characters become a reference, named where a name exists and &#x…; where one doesn’t.

Encoding always escapes &amp;, &lt;, &gt;, &quot; and &#39; — the characters that mean something to an HTML parser.

Runs in your browser. Nothing you enter is sent anywhere.