XML Double Quote Converter

Re-serializes every attribute value in an XML document using double quotes, correctly re-escaping only the double-quote character (and unescaping any unnecessary single-quote escaping), for consistent style across a document with mixed quoting. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-23

Overview

Introduction

XML allows both single and double quotes around attribute values, but a document with a mix of both looks inconsistent.

This tool standardizes on double quotes.

What Is XML Double Quote Converter?

A quote-normalizing tool that re-serializes every attribute value using double quotes.

It re-escapes content correctly for the new delimiter.

How XML Double Quote Converter Works

The document is parsed and re-serialized.

Every attribute value is written between double quotes, with any literal double-quote characters inside the value escaped as "; single quotes inside the value are left as literal characters since they no longer need escaping.

When To Use XML Double Quote Converter

Use it to standardize quote style across a document assembled from multiple sources.

It's equally useful on a document that's been hand-edited inconsistently over time.

Features

Advantages

  • Standardizes an entire document's attribute quoting in one pass.
  • Correctly re-escapes content for the new quote character.
  • Runs entirely client-side.

Limitations

  • Only affects attribute-value quoting, not element structure or content.
  • Re-indents the whole document as a side effect of re-serialization, matching this category's standard pretty-printing.

Examples

Normalizing mixed quotes

Input

<a b='x' c="y"/>

Output

<a b="x" c="y" />

The single-quoted attribute is rewritten with double quotes; the already-double-quoted one is untouched.

Best Practices & Notes

Best Practices

  • Double quotes are the more common convention in hand-written and generated XML, prefer this over single quotes unless a specific tool requires otherwise.
  • Run this before committing an XML file assembled by hand from multiple copy-pasted snippets.
  • Use Use Single Quotes Everywhere instead if your target tooling specifically expects single quotes.

Developer Notes

Serialization logic lives in `normalize-xml-quotes.ts` and shares its structure with `toPrettyXml`, except the attribute-escaping function takes the target quote character as a parameter.

XML Double Quote Converter Use Cases

  • Standardizing attribute quote style across a document assembled from multiple sources
  • Cleaning up inconsistent quoting before a code review or commit
  • Matching a linter or style guide that requires double-quoted XML attributes

Common Mistakes

  • Expecting this to also reformat element structure, only attribute quoting changes.
  • Assuming already-double-quoted attributes are left byte-for-byte identical, they're re-serialized (and thus re-indented) along with everything else.

Tips

  • Use Use Single Quotes Everywhere for the opposite normalization.
  • Check the FAQ above if the output doesn't look like what you expected.

References

Frequently Asked Questions