The six characters
Unicode has two straight marks and four curly ones. The straight quotation mark U+0022 is described in the Unicode names list as neutral, used as either an opening or a closing mark, and its notes say the preferred characters in English for paired quotation marks are U+201C and U+201D. The straight apostrophe U+0027 carries the matching note: U+2019 is preferred for the apostrophe, and U+2018 and U+2019 are the preferred pair for single quotes. The table gives the code point and HTML entities for each, and the key sequence Microsoft documents for Word on Windows.
| Char | Name | Code | Named | Numeric | Word, Windows | Use |
|---|---|---|---|---|---|---|
| " | Quotation mark | U+0022 | " | " | hold Alt, type 34 | Code: JSON strings, HTML attributes, most programming languages |
| ' | Apostrophe | U+0027 | ' | ' | hold Alt, type 39 | Code: single-quoted strings in JavaScript, Python, shell, SQL |
| ‘ | Left single quotation mark | U+2018 | ‘ | ‘ | 2018, then Alt+X | Text: opening single quote |
| ’ | Right single quotation mark | U+2019 | ’ | ’ | 2019, then Alt+X | Text: closing single quote and the apostrophe |
| “ | Left double quotation mark | U+201C | “ | “ | 201C, then Alt+X | Text: opening double quote |
| ” | Right double quotation mark | U+201D | ” | ” | 201D, then Alt+X | Text: closing double quote |
The Windows column is Microsoft's general method for Unicode characters in Word: type the hexadecimal code, then press Alt+X, and the code turns into the character. The straight pair also has the older ASCII method the same page lists: hold Alt while typing the decimal code. Apple's help page for smart quotes documents the setting, not a key combination, so there is no Mac column; on a Mac the usual route is to leave smart quotes on and type the quote key.
When to use which
The rule is short. Prose gets curly quotes, code gets straight ones.
- Prose, documents, web copy, email. Curly. Opening “ before the quotation, closing ” after it, single marks for a quotation inside a quotation, and ’ for every apostrophe: don’t, it’s, the ’90s. Word processors and phone keyboards do this automatically when smart quotes are on.
- Code, configuration, commands, data. Straight. A JSON key, a JavaScript string, a shell argument, a SQL literal and an HTML attribute value all need U+0022 or U+0027. A curly quote in any of them is a syntax error or, worse, silently part of the value.
- Code inside prose. Straight inside the code span, curly around it. A sentence that says “set the value to "true"” is correct: the outer marks are typography, the inner ones are code.
- Plain-text contexts that render as typed. File names, URLs, form fields that feed a database, and anything you paste into a terminal: straight, because nothing will convert them and a curly character can end up in the data.
Dashes follow the same split, with the hyphen-minus on the keyboard for code and the en and em dashes for text; the em dash, en dash and hyphen guide covers those three.
Why curly quotes break code
RFC 8259, the JSON specification, defines a string as beginning and ending with quotation marks, and its grammar names the delimiter exactly: quotation-mark = %x22, which is U+0022. A parser reading U+201C does not see a quotation mark at all; it sees a character that is not allowed outside a string. The same JSON typed twice shows the difference:
{ "name": "Ada", "role": "engineer" } valid
{ “name”: “Ada”, “role”: “engineer” } not valid: U+201C is not a quotation mark The second version is what you get when a snippet passes through a word processor, a chat window or an email client with smart quotes on. The JSON formatter flags it on the first character, which is the quickest diagnosis when a config file that looks right will not load. Programming languages delimit their own string literals with the straight characters in the same way; a curly quote inside a string is just data, and a curly quote in place of the delimiter is an error.
The settings that swap them
Both desktop systems replace straight quotes with curly ones as you type, and both let you turn it off.
- Word on Windows and Mac. File, Options, Proofing, AutoCorrect Options, then the AutoFormat As You Type tab. The box is labeled Straight quotes with smart quotes, under Replace as you type. Clear it to keep what you type; select it to get curly quotes. Word also treats a quote typed after an em dash as an opening mark.
- macOS. System Settings, Keyboard, then Edit under Text Input, and the switch Use smart quotes and dashes. The For double quotes and For single quotes menus pick the style. To convert text that already exists, select it and choose Edit, Substitutions, Show Substitutions, tick Smart Quotes, then Replace in Selection or Replace All.
- Code editors. Leave the default. Editors insert straight quotes and do not convert; the problem only arises when text travels from a document into a code file.
Pasting is where the two worlds meet. A command copied from a formatted page may carry curly quotes into the terminal, and a paragraph pasted from a code editor into a document arrives with straight ones that the document will not retroactively fix. The AI text cleaner turns the first case around: it normalizes smart quotes and other fancy punctuation back to the plain characters, which is the right move for anything that will be executed or parsed.
HTML entities and encoding
In HTML, each of the six has a named character reference from the WHATWG list: ‘, ’, “, ” for the curly marks, " and ' for the straight ones. Numeric references work everywhere, ‘, ’, “, ” for the same four. On a UTF-8 page you can type the characters directly, which is what UTF-8 and Unicode explained is about; the entities earn their keep inside an attribute whose delimiter is the same straight quote, or in a file whose encoding you do not control. The HTML entity converter goes both ways and lists the names.
Converting a whole text
- Code to clean up: replace “ and ” with " and ‘ and ’ with ' using the find and replace tool, or run the AI text cleaner, which does all four at once.
- Prose to typeset: replace " with “ before a word and ” after one. A regular expression with a lookahead for a letter does the opening marks; the remaining straight ones are closers. Check apostrophes last, since every one should be ’, including the one at the start of ’90s, where an automatic conversion can insert the opening mark ‘ instead because the quote sits before a word.
- Check the result by searching for the straight characters. A text meant for print should contain none; a code file should contain no U+2018 to U+201D at all.
Frequently asked questions
What are smart quotes?
The curved quotation marks that word processors insert when you type a quote key: “ and ” for double quotes, ‘ and ’ for single quotes and the apostrophe. They are four separate Unicode characters, U+201C, U+201D, U+2018 and U+2019, with a distinct opening and closing shape. Straight quotes are the two characters on the keyboard, U+0022 and U+0027, which look the same at both ends of a quotation.
Which quotes should I use in writing?
Curly ones. The Unicode character chart notes for the straight quotation mark say the preferred characters in English for paired quotation marks are U+201C and U+201D, and that U+2019 is preferred for the apostrophe. Word processors and phones do the conversion for you when smart quotes are on, so in ordinary prose you rarely have to think about it.
Why do curly quotes break code?
Because the language only recognizes the straight character. The JSON grammar in RFC 8259 defines the string delimiter as exactly U+0022, so a parser reading “name” sees two unknown characters, not a string. The same applies to most programming languages, shell commands and configuration files, and the error message usually points at an unexpected character.
How do I turn smart quotes off?
In Word, go to File, Options, Proofing, AutoCorrect Options, then the AutoFormat As You Type tab, and clear the box labeled Straight quotes with smart quotes. On a Mac, open System Settings, Keyboard, then Edit under Text Input, and turn off Use smart quotes and dashes. Code editors use straight quotes by default and do not need the change.
How do I type a curly quote in Word on Windows?
Type the hexadecimal code and press Alt+X: 201C then Alt+X gives “, 201D gives ”, 2018 gives ‘, 2019 gives ’. That is the method Microsoft documents for inserting any Unicode character in Word. With smart quotes on, you can also just type the quote key and let AutoFormat pick the opening or closing shape.
Which HTML entity is a curly quote?
The WHATWG named character references are “ and ” for the double quotes, ‘ and ’ for the single quotes, and " and ' for the straight ones. In a UTF-8 page you can simply type the curly characters themselves; the entities matter where the file encoding is uncertain or inside an attribute that uses the same straight quote as its delimiter.
Sources
- Unicode Character Database, NamesList.txt (U+0022 QUOTATION MARK: neutral, used as opening or closing quotation mark, preferred characters in English for paired quotation marks are 201C and 201D; U+0027 APOSTROPHE: 2019 is preferred for apostrophe, paired marks 2018 and 2019)
- Unicode Utilities, character properties for U+2019 RIGHT SINGLE QUOTATION MARK (names-list comment: this is the preferred character to use for apostrophe)
- Unicode Utilities, U+2018 LEFT SINGLE QUOTATION MARK, U+201C LEFT DOUBLE QUOTATION MARK, U+201D RIGHT DOUBLE QUOTATION MARK (character names)
- WHATWG HTML Standard, named character references (ldquo U+201C, rdquo U+201D, lsquo U+2018, rsquo U+2019, quot U+0022, apos U+0027)
- RFC 8259, The JavaScript Object Notation (JSON) Data Interchange Format, section 7 Strings (a string begins and ends with quotation marks; quotation-mark = %x22, U+0022)
- Microsoft Support, Smart quotes in Word and PowerPoint (the Straight quotes with smart quotes option on the AutoFormat As You Type tab under File, Options, Proofing, AutoCorrect Options)
- Microsoft Support, Insert ASCII or Unicode Latin-based symbols and characters (type the character code, press Alt, then X for a Unicode character; hold Alt while typing the code for an ASCII character; Alt+34 for " and Alt+39 for ')
- Apple Support, Use smart quotes and dashes on Mac (System Settings, Keyboard, Text Input, Edit, Use smart quotes and dashes; the For double quotes and For single quotes menus; Edit, Substitutions, Show Substitutions to replace in existing text)