Formatting presets and recipes

A recipe pins the formatter version, every option and the preservation policy, so the same input always gives the same output.

Built-in recipes

Safe default

2-space indent, attributes wrap past 100 columns, nothing normalised except indentation.

format · indent 2 · attrs wrap · empty preserve

Review friendly

Each attribute on its own line when there are two or more — small, readable diffs in code review.

format · indent 2 · attrs each-line · empty preserve

Config files (4 spaces)

4-space indent with aligned attributes, typical for Maven, Spring and .NET config.

format · indent 4 · attrs aligned · empty preserve

Tabs

Tab indentation, attributes kept on one line.

format · indent tab · attrs one-line · empty preserve

Normalised style

Double quotes, sorted attributes (namespace declarations first) and <a/> for empty elements. Reports every normalisation.

format · indent 2 · attrs wrap · empty self-close

Minify (keep comments)

Removes formatting whitespace only; comments and all text are kept.

minify · indent 2 · attrs one-line · empty preserve

Minify and strip comments

Also removes comments outside protected regions — explicit information loss.

minify · indent 2 · attrs one-line · empty self-close

Your recipes (stored in this browser)

None yet. Import one below.

Selected: Safe default (format)

{
  "schema": "beautifyxml.recipe/1",
  "id": "safe-default",
  "name": "Safe default",
  "description": "2-space indent, attributes wrap past 100 columns, nothing normalised except indentation.",
  "mode": "format",
  "formatter": "bxml-format 1.0.0",
  "options": {
    "indent": 2,
    "maxWidth": 100,
    "attrLayout": "wrap",
    "attrOrder": "source",
    "quote": "preserve",
    "emptyStyle": "preserve",
    "selfCloseSpace": false,
    "newline": "auto",
    "keepBlankLines": true,
    "stripComments": false
  },
  "policy": "protect-mixed-content"
}

Output on the order sample

<?xml version="1.0" encoding="UTF-8"?>
<!-- Synthetic order payload for BeautifyXML demos -->
<order
  xmlns="urn:example:orders:v2"
  xmlns:addr="urn:example:address"
  id="SO-10442"
  status="confirmed"
  created="2026-10-30T09:12:00Z">
  <customer ref="C-221">
    <name>Asha Rao</name>
    <addr:postal country="IN">
      <addr:line>14 Lake View Road</addr:line>
      <addr:city>Pune</addr:city>
    </addr:postal>
  </customer>
  <lines>
    <line sku="KB-87" qty="2" unit="EUR">49.90</line>
    <line sku="MS-03" qty="1" unit="EUR">19.00</line>
  </lines>
  <note>Leave with <em>reception</em> if nobody answers.  Fragile!</note>
  <instructions xml:space="preserve">
  Gate code:   4471
  Ring twice.
</instructions>
  <empty-flag></empty-flag>
</order>

What a recipe contains

A recipe is a small JSON document with schema "beautifyxml.recipe/1": a name, the mode (format or minify), the formatter version, every option, and the preservation policy "protect-mixed-content". Importing validates each key and value; unknown keys — including anything that looks like a script or stylesheet — are rejected.

Custom recipes are stored in this browser’s IndexedDB. Export them to share with your team; they contain no XML.

Questions

Can a recipe run XSLT?

No. Recipes are data only and accept a fixed set of options. Arbitrary XSLT and remote resolution are excluded from BeautifyXML.

Where do I use a recipe?

Choose it from the Preset menu in the formatter, minifier or batch tool.