Spintax by example

The fastest way to understand spintax is to watch finished text become a template. So we took a real paragraph — the About Spintax block from our own homepage — and reverse-authored it, one technique at a time, exactly the way the reverse-authoring guide describes. Every construct below is coloured the way our editor extensions colour it; every step links to its full guide.

The finished text

Reverse authoring starts from copy you are already happy with, then adds markup last. Here is one sentence of the source — the same words you can read in the About Spintax block:

Spintax is our own template language for producing many genuinely unique variations of a text from a single source you control.

Nothing below invents new wording. We only mark up choices the author already had in mind.

1. A vocabulary of choices

Before touching a sentence, declare the reusable words once. #set re-rolls on every use; #def rolls a value once and keeps it (so a number and its noun stay in step). Edit a line here and every sentence that uses it changes.

#set %Unique% = {genuinely unique|truly distinct|non-repeating}
#set %Engine% = {engine|spintax engine|renderer}
#def %pages% = {1|3|48}

Full guide: Variables →

2. Swap words and whole clauses

The core operator is {a|b|c}. Fork the smallest span that differs — a single word — or a whole opening clause, always leaving the shared tail outside the fork so grammar can never desync.

Spintax {(spin syntax)|— "spin syntax" —} is %OwnLang% for
{producing|generating} many %Unique% variations of a text.

Only the parenthetical differs, so only it is forked — the shared Spintax…is stays outside the braces. Forking the whole {Spintax…is|Spintax…is} would repeat the fixed parts and invite them to drift.

Full guide: Grammar-safe synonymization →

3. Pick and reorder with permutations

A permutation [<…> a|b|c] selects a random subset and shuffles the order — far more variety than stacking synonyms. Here the feature list picks three-to-six items each render; the engine list keeps all four but reorders them (minsize=maxsize=4).

It adds [<minsize=3;maxsize=6;sep=", ";lastsep=", and "> permutations|scoped variables|value-driven conditionals|plural agreement|reusable includes|post-processing].

… for [<minsize=4;maxsize=4;sep=", ";lastsep=", and "> JavaScript|PHP|Python|Object Pascal]

Full guide: Permutations →

4. Branch on a value

A conditional {?VAR?then|else} chooses by a variable's value, not at random. Toggle one #def and a whole clause changes together.

#def %ai% = {yes|}{?ai?Have an AI draft the template once|Write one template by hand}; the %Engine% then renders unlimited variants.

Full guide: Conditional spintax →

5. Agree with the count

{plural %n%: one|many} picks the right noun form for a number. Because %pages% was a #def, the number and its noun always match — and a plural nests happily inside a permutation.

across [<minsize=1;maxsize=3;sep=", ";lastsep=", or "> %pages% {plural %pages%: page|pages}|dozens of sites|many locales]

Renders 1 page, 3 pages, 48 pages — never "1 pages". Full guide: Plurals →

6. Decline with cases (Russian)

English gets away with one noun form; inflected languages do not. In the Russian version of this template a noun that appears in several cases becomes a case family — one #def per form, a single word each (never a synonym list, or the forms would re-roll out of agreement):

#def %BrandGen% = магазина
#def %BrandDat% = магазину
#def %BrandPrep% = магазине

Then each preposition binds its case in one branch: об этом %BrandPrep%, для %BrandGen%, к %BrandDat%. See the Russian version of this page for the full paragraph. Full guide: Grammar-safe (Russian cases) →

The whole template

#set %OwnLang% = {our own template language|a markup language we built|our own template syntax}
#set %Unique% = {genuinely unique|truly distinct|non-repeating}
#set %Source% = {a single source you control|one master you own|a single source of truth}
#set %Engine% = {engine|spintax engine|renderer}
#set %N% = {hundreds|thousands|millions}
#def %ai% = {yes|}
#def %pages% = {1|3|48}

<p>Spintax {(spin syntax)|— "spin syntax" —} is %OwnLang% for {producing|generating} many %Unique% variations of a text from %Source%. You write one template that encodes every choice — [<minsize=4;maxsize=4;sep=", ";lastsep=", and "> alternatives|orderings|conditions|variables] — and the %Engine% expands it into %N% of %Unique% variants. {Every variation is one you defined|You define every variation}, so the output stays {on-brand and correct|accurate and on-brand} rather than a probabilistic guess.</p>
<p>The {modern|AI-era} workflow {pairs|combines} a {language model|large language model} with that template logic. {?ai?Have an AI draft the richly varied template once|Write one richly varied template by hand}; the %Engine% then renders unlimited unique variants {locally|on your own hardware}, deterministically, and at near-zero cost.</p>
<p>With spintax you {roll out|publish} %Unique% content across [<minsize=1;maxsize=3;sep=", ";lastsep=", or "> %pages% {plural %pages%: page|pages}|dozens of sites|many locales] — unique by construction, not spun gibberish.</p>
<p>Modern spintax is far more than flat alternation. It adds [<minsize=3;maxsize=6;sep=", ";lastsep=", and "> permutations that pick and order a subset|scoped variables|value-driven conditionals|locale-aware plural agreement|reusable includes|a post-processing pass for spacing and capitalisation].</p>
<p>And it {runs wherever you do|works anywhere you deploy}: four {independent|standalone}, open-source implementations — for [<minsize=4;maxsize=4;sep=", ";lastsep=", and "> JavaScript|PHP|Python|Object Pascal] — all held to one shared corpus so a template renders identically on every one.</p>

How it is coloured (the same scopes our editor extensions use):

  • #set directive (#set / #def)
  • {a|b} alternation {a|b}
  • [<…>] permutation [<…> a|b]
  • %VAR% variable %VAR%
  • {?…} conditional {?…}
  • {plural} plural {plural …}

Opens the playground with this template loaded — hit Generate for endless live variants, or edit it.

Three real renders

One template, three different texts — actual @spintax/core output at fixed seeds. Watch the conditional flip, the count agree, and the lists reorder.

Render 1 seed 1

Spintax — "spin syntax" — is our own template syntax for generating many genuinely unique variations of a text from one master you own. You write one template that encodes every choice — alternatives, variables, orderings, and conditions — and the spintax engine expands it into thousands of genuinely unique variants. Every variation is one you defined, so the output stays on-brand and correct rather than a probabilistic guess.

The modern workflow pairs a language model with that template logic. Write one richly varied template by hand; the spintax engine then renders unlimited unique variants on your own hardware, deterministically, and at near-zero cost.

With spintax you roll out genuinely unique content across 1 page — unique by construction, not spun gibberish.

Modern spintax is far more than flat alternation. It adds permutations that pick and order a subset, locale-aware plural agreement, reusable includes, value-driven conditionals, a post-processing pass for spacing and capitalisation, and scoped variables.

And it runs wherever you do: four standalone, open-source implementations — for JavaScript, Object Pascal, Python, and PHP — all held to one shared corpus so a template renders identically on every one.

Render 2 seed 8

Spintax (spin syntax) is our own template syntax for generating many truly distinct variations of a text from a single source of truth. You write one template that encodes every choice — conditions, variables, orderings, and alternatives — and the spintax engine expands it into hundreds of truly distinct variants. Every variation is one you defined, so the output stays on-brand and correct rather than a probabilistic guess.

The AI-era workflow combines a language model with that template logic. Have an AI draft the richly varied template once; the engine then renders unlimited unique variants locally, deterministically, and at near-zero cost.

With spintax you publish truly distinct content across dozens of sites, 3 pages, or many locales — unique by construction, not spun gibberish.

Modern spintax is far more than flat alternation. It adds reusable includes, permutations that pick and order a subset, locale-aware plural agreement, and scoped variables.

And it works anywhere you deploy: four independent, open-source implementations — for JavaScript, PHP, Object Pascal, and Python — all held to one shared corpus so a template renders identically on every one.

Render 3 seed 5

Spintax (spin syntax) is a markup language we built for producing many truly distinct variations of a text from a single source of truth. You write one template that encodes every choice — variables, alternatives, conditions, and orderings — and the renderer expands it into millions of truly distinct variants. Every variation is one you defined, so the output stays on-brand and correct rather than a probabilistic guess.

The modern workflow combines a language model with that template logic. Write one richly varied template by hand; the renderer then renders unlimited unique variants on your own hardware, deterministically, and at near-zero cost.

With spintax you roll out genuinely unique content across dozens of sites, many locales, or 48 pages — unique by construction, not spun gibberish.

Modern spintax is far more than flat alternation. It adds a post-processing pass for spacing and capitalisation, scoped variables, and locale-aware plural agreement.

And it runs wherever you do: four independent, open-source implementations — for PHP, Python, JavaScript, and Object Pascal — all held to one shared corpus so a template renders identically on every one.

Get this highlighting in your editor

The colours above are the grammar we ship as editor extensions — install it and your own templates light up the same way: VS Code (301st.spintax) or Sublime Text (Package Control: Spintax).

Where to go next