Formatting quotes
How smart and straight quote tools convert quotation marks and apostrophes, which characters they use, where conversion goes wrong, and how to check the result.
Formatting quotes in digital text usually means choosing between two sets of characters. Straight quotes are the marks a keyboard types by default. Smart quotes are the curved marks used in typeset text. A quote formatting tool converts one set to the other. This guide explains what that conversion changes, what it should leave alone, and how to check the result.
What a quote formatting tool does
A quote formatting tool, sometimes called a smart quote converter or a quote straightener, takes plain text as input and replaces its quotation mark characters. Converting to smart quotes replaces each straight mark with a curved opening or closing mark, depending on where it sits. Converting to straight quotes does the reverse and replaces every curved mark with its straight equivalent. Letters, spacing and other punctuation should stay as they were. Only quote and apostrophe characters change.
Straight and curly marks are separate Unicode characters, not two styles of the same character. As a result, a search for a straight apostrophe may not find a curly one. The difference also matters for any text that software has to read.
| Character | Name | Unicode code point | Typical use |
| " | Quotation mark (straight double) | U+0022 | Code, data files, plain keyboard input |
| ' | Apostrophe (straight single) | U+0027 | Code, data files, plain keyboard input |
| “ | Left double quotation mark | U+201C | Opening a quotation |
| ” | Right double quotation mark | U+201D | Closing a quotation |
| ‘ | Left single quotation mark | U+2018 | Opening a nested quotation |
| ’ | Right single quotation mark | U+2019 | Closing a nested quotation; typographic apostrophe |
Which direction you need
- Straight to smart: use this for prose that people will read, such as articles, books, presentations and printed material. Curved marks are the typographic convention there.
- Smart to straight: use this for text that software will read, such as source code, JSON, CSV, command lines, configuration files and search queries. In these formats only the straight characters work as delimiters.
Mixed documents need care. If a passage of prose contains a code sample, converting the whole document will also curl the quotes inside the code, and that can break it. Apply the conversion only to the parts that should change. Alternatively, use a tool whose documentation says it skips code sections.
How straight-to-smart conversion chooses a direction
A straight quote does not show whether it opens or closes a quotation, so the converter has to work it out from the neighboring characters. A common rule is that a mark after a space, at the start of a line or after an opening bracket becomes an opening mark. A mark after a letter, digit or punctuation becomes a closing mark. The exact rules differ between tools.
Illustrative example, not output from a specific tool:
Input: She said, "Don't touch the 'red' button."
Output: She said, “Don’t touch the ‘red’ button.”
In this example the apostrophe in Don’t becomes U+2019, which is the same character as a closing single quote. That is the standard typographic apostrophe, not an error.
Cases that often convert incorrectly
- Apostrophes at the start of a word: in '90s, 'til and rock 'n' roll, the first mark follows a space. A position-based rule may therefore turn it into an opening single quote (‘90s). The correct character is the apostrophe, U+2019 (’90s).
- Measurements and coordinates: feet and inches, or minutes and seconds, are written with prime marks, not quotes. For example, 5′11″ uses U+2032 (prime) and U+2033 (double prime). A converter may turn 5'11" into curly quotes, which is wrong in typeset text.
- Quotes next to other punctuation: a mark right after an opening parenthesis, a dash or another quote mark can be misread. For example, a nested quotation that ends with '" needs a closing single mark followed by a closing double mark: ’”.
- Quotations that run across paragraphs: in US style, the opening mark is repeated at the start of each paragraph, and the closing mark appears only at the end. A converter that expects every opening mark to have a matching closing mark may mishandle this.
- Code, file paths, command examples and data values inside prose: if their quotes are curled, they stop working when someone copies them.
What quote conversion does not change
Converting quote characters does not move punctuation or correct the quotation style. In US style, double quotes enclose a quotation, single quotes enclose a quotation inside it, and periods and commas go inside the closing mark. If a text uses single quotes as its outer marks, or puts a period outside the closing mark, a character converter will curl those marks where they are but will not rearrange anything. Those fixes are editing decisions that need to be made separately.
Step by step: formatting quotes in a text
- 1. Decide who the text is for: human readers (smart quotes) or software (straight quotes).
- 2. Make a copy of the original text so you can compare the versions and undo changes.
- 3. Separate or mark any parts that must not change, such as code samples, data values, command examples and measurements.
- 4. Run the conversion in the chosen direction on the rest of the text.
- 5. Review the risky spots listed above: apostrophes at the start of words, measurements, nested quotes, and quotes next to brackets or dashes.
- 6. Correct any remaining marks by hand, entering the exact character needed (for example, U+2019 for an apostrophe).
- 7. Verify the result as described below.
How to verify the result
- Compare with the original: a side-by-side or difference view should show changes only to quote and apostrophe characters. Any other changed character, including spacing, was not intended.
- Search for leftovers: after converting to smart quotes, search for " and ' to find marks the tool missed. After converting to straight quotes, search for “ ” ‘ ’ to confirm that none remain.
- Check that opening and closing marks pair up: count the opening and closing double marks in each quotation. A missing or extra mark usually means the tool chose the wrong direction somewhere.
- Inspect code points when a mark is hard to identify: in some fonts the apostrophe, the closing single quote and the prime look almost identical. A character inspector or code point viewer shows whether a mark is U+0027, U+2019 or U+2032.
- Test machine-readable text: if the text is code or data, run or parse it once after conversion to confirm that the quotes still work as delimiters.
Limits of this guide
No evidence about a specific product was available, so this guide describes the general operation rather than any particular tool's settings, rules or accuracy. Before relying on a converter for a long or important text, test it on a short sample that contains the difficult cases above. Check how it handles apostrophes, primes and code.