XML Single Quote Converter

Re-serializes every attribute value in an XML document using single quotes, correctly re-escaping only the single-quote character, the mirror image of Use Double Quotes Everywhere. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-23

Overview

Introduction

While double quotes are more common in XML, single quotes are equally valid and preferred by some tooling and style guides.

This tool standardizes a document to single quotes.

What Is XML Single Quote Converter?

The mirror image of Use Double Quotes Everywhere.

It's a quote-normalizing tool that re-serializes every attribute value using single quotes.

How XML Single Quote Converter Works

The document is parsed and re-serialized.

Every attribute value is written between single quotes, with any literal single-quote characters inside the value escaped as '; double quotes inside the value are left as literal characters.

When To Use XML Single Quote Converter

Use it to match a code generator, templating system, or style guide that expects single-quoted XML attributes.

It's also useful for standardizing quote style across a document assembled from multiple sources.

Features

Advantages

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

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 to single quotes

Input

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

Output

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

The double-quoted attribute is rewritten with single quotes.

Best Practices & Notes

Best Practices

  • Confirm your downstream tooling actually accepts single-quoted XML attributes before standardizing on this style, some strict consumers expect double quotes.
  • Use Use Double Quotes Everywhere instead if you're not sure which convention your target system needs.
  • Run the XML Validator after converting, to confirm the result is still well-formed.

Developer Notes

This shares its serialization logic with Use Double Quotes Everywhere (`normalize-xml-quotes.ts`), differing only in the quote character passed in.

XML Single Quote Converter Use Cases

  • Matching a code generator or style guide that expects single-quoted attributes
  • Standardizing quote style across a document assembled from multiple sources
  • Preparing XML for a templating system that emits single-quoted attributes by convention

Common Mistakes

  • Expecting this to also reformat element structure, only attribute quoting changes.
  • Assuming double quotes are always the safer default, XML treats both as equally valid.

Tips

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

References

Frequently Asked Questions