Skip to content
Utilboxes

How to convert curly quotes to straight quotes

Smart quotes from Word and Docs break code, CSV files, passwords and search. How to straighten them, plus em dashes and ellipses, and how to stop them being added.

Published

Tools for this job: Text Cleaner · JSON Validator

Word processors replace the straight quote marks you type, " and ', with curly “typographic” ones. In a printed letter they look better. Pasted into code, a command line, a spreadsheet formula or a configuration file, they break things, and the error message rarely says why.

Where curly quotes cause trouble

  • Code and JSON: {“name”: “Ana”} is invalid JSON; only straight double quotes are allowed. The JSON Validator flags it, but the cause is easy to miss.
  • Terminal commands copied from a document: the shell does not treat curly quotes as quotes.
  • Spreadsheet formulas: =IF(A1=“yes”,1,0) fails.
  • Passwords and codes: a password containing an apostrophe, typed into a document and copied, may no longer match.
  • Search and matching: searching for don't with a straight apostrophe may not find don’t with a curly one.

Straighten them step by step

  1. Paste the text into the Text Cleaner.
  2. Make sure “Straighten smart quotes and dashes” is on. Curly single and double quotes become straight ones.
  3. Copy the result. The panel shows how many smart characters it found.

The text is cleaned in your browser and not sent anywhere.

Dashes, ellipses and spaces too

The same step converts other typographic characters into plain equivalents:

  • Em and en dashes (— and –) become hyphens.
  • The single ellipsis character (…) becomes three full stops.
  • Non-breaking spaces become ordinary spaces.

Non-breaking spaces are a common hidden cause of failed matches: they look exactly like spaces but are a different character.

Stop them being added

  • Word: File → Options → Proofing → AutoCorrect Options → AutoFormat As You Type, and untick “Straight quotes with smart quotes”.
  • Google Docs: Tools → Preferences, and untick “Use smart quotes”.
  • macOS and iOS: smart punctuation is a system keyboard setting. Turn it off if you often type code or commands.
  • Best habit: write code and commands in a code editor or plain-text editor, never a word processor.

Checking a whole file

If a script or data file fails and you suspect smart quotes, search it in a code editor for the four curly characters: “ ” ‘ ’. Many code editors also highlight unusual Unicode characters. For a CSV exported from a word processor or a spreadsheet that was typed in by hand, cleaning the whole file once is quicker than fixing the rows that fail one by one.

When to keep curly quotes

For published prose, such as books, articles and web pages, curly quotes and proper dashes are correct typography. Straighten text only when it is going somewhere that needs plain characters. If you have stripped them from an article by mistake, a word processor can re-apply them via its AutoFormat feature.

For invalid JSON in general, see how to fix invalid JSON. For other hidden characters, see removing invisible characters.

Tools used in this guide

More tools for this job

All guides