Change All Quotes to Double Quotes

Paste YAML with a mix of unquoted, single-quoted, and double-quoted strings and get back the same document with every string, both mapping keys and values, consistently double-quoted. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-22

Overview

Introduction

YAML lets every string be written unquoted, single-quoted, or double-quoted, which is flexible but means a document assembled from several sources often ends up with an inconsistent mix of all three. This tool normalizes that: every string, key or value, comes out double-quoted.

Double quotes are the style most other languages' string literals resemble, and the only YAML quote style that supports backslash escape sequences (like `\n`), which makes it a common target for teams standardizing config style.

What Is Change All Quotes to Double Quotes?

A YAML re-quoting tool that parses a document and re-serializes every string scalar, unquoted, single-quoted, or already double-quoted, uniformly as a double-quoted string.

It operates on the parsed value rather than the raw text, so it never mis-quotes a string or mishandles an edge case the way a text-based find/replace on quote characters could.

How Change All Quotes to Double Quotes Works

The input is parsed with a full YAML 1.2 parser. It's then re-serialized using the `yaml` package's `defaultStringType` and `defaultKeyType` stringify options set to `"QUOTE_DOUBLE"`, which tells the stringifier to prefer double quotes for every string scalar it writes, both keys and values, rather than YAML's usual heuristic of using the most compact style that's unambiguous.

Non-string values (numbers, booleans, null) are unaffected, since they aren't strings to begin with; only values whose resolved type is `string` are subject to the quoting change.

When To Use Change All Quotes to Double Quotes

Use it to standardize quoting style across a config file assembled or edited by multiple people over time.

It's also useful when a team's style guide or linter specifically requires double-quoted strings in YAML.

Features

Advantages

  • Correctly re-quotes every string via a real YAML stringifier, handling internal escaping automatically.
  • Applies consistently to both mapping keys and values, not just one or the other.
  • Never changes a value's underlying type, only its quoting style.
  • Runs entirely client-side, so configuration data never leaves your browser.

Limitations

  • Comments are dropped, since the transformation parses and re-serializes the document, the same tradeoff as the YAML Formatter.
  • Because every string is now double-quoted, including simple ones that didn't need quoting, the output is often visually noisier than the more compact 'quote only when necessary' style YAML tools usually default to.
  • Only the first document in a multi-document (`---`-separated) YAML stream is processed.

Examples

Standardizing mixed quote styles

Input

name: 'api'
region: us-east

Output

"name": "api"
"region": "us-east"

Both the single-quoted and originally-unquoted strings, plus their keys, come out consistently double-quoted.

Numbers and booleans stay unquoted

Input

active: true
count: 3

Output

"active": true
"count": 3

Only string-typed values are affected; non-string scalars keep their original type.

Best Practices & Notes

Best Practices

  • Agree on a quoting convention as a team before adopting this in a workflow, so future edits follow the same style rather than drifting again.
  • Run this after, not before, any manual edits you're making to a file, so you're not fighting the re-quoting while you work.
  • Use YAML Diff afterward to confirm only quoting changed, not any actual data.

Developer Notes

The conversion relies entirely on the `yaml` package's `defaultStringType`/`defaultKeyType: "QUOTE_DOUBLE"` stringify options rather than any custom quoting logic, verified directly against the package's TypeScript definitions (`Scalar.Type`) to confirm the exact option name and accepted values before implementing. `defaultKeyType` is set explicitly even though it would fall back to `defaultStringType` by default, since being explicit here is clearer than relying on an implicit default.

Change All Quotes to Double Quotes Use Cases

  • Standardizing quoting style across a YAML config maintained by multiple contributors
  • Meeting a team style guide or linter rule that requires double-quoted YAML strings
  • Normalizing YAML pulled from several different sources with inconsistent quoting before merging
  • Preparing YAML for a downstream tool or template that expects consistently double-quoted strings

Common Mistakes

  • Expecting numbers or booleans to get quoted too, they don't, since that would change their type.
  • Forgetting that mapping keys are quoted along with values, if you only wanted values quoted, this tool's output will look more aggressive than expected.
  • Losing comments during the conversion without realizing it, the same tradeoff as any parse-and-reserialize YAML tool.

Tips

  • Use YAML Diff before and after to confirm the only changes are quoting-related, not accidental data changes.
  • If you specifically want unquoted strings to stay unquoted, this isn't the right tool, it standardizes to double quotes across the board.
  • Pair with YAML Formatter if you also want consistent indentation alongside consistent quoting.

References

Frequently Asked Questions