Fix quotes, dashes, ellipses and no-break spaces in 35 locales
polytypo is a typography library for JavaScript, Python, Go, Ruby and PHP. Paste text, pick a locale, get locale-correct typography back.
It turns straight quotes into the locale's quotation marks, sets dashes and ellipses, and inserts no-break spaces, with byte-identical output in all five runtimes.
Version 1.33.0 · 26 November 2026
More than 35,379 downloads since September 8, 2026.
Using an AI coding agent? Give it the polytypo SKILL.md and ask it to set polytypo up in your project.
Try it
Paste your text. Pick a locale.
This is the real engine, running in your browser. Nothing you type is sent anywhere.
The call the form above is making, right now
Full call reference — Docs.
Proof
The same sentence. Six different, correct answers.
Every card below runs the exact same input string through transform(). Only the
locale changes; quote style, dash style, and spacing all follow.
Input — what any of the locales below changes is marked
English (US) opens with a curly double quote and a tight em dash. British English swaps the
primary and secondary levels round, with a spaced en dash instead. German lowers the opening
quote. Swiss German turns it into guillemets pointing outward. French puts a no-break space
inside its guillemets (U+00A0) and a narrow one before
! ? ; (U+202F). Russian pairs French-style guillemets with German's
low-high secondary marks. Every one of these is correct — in exactly one place.
Quotes, dashes and spacing for every language, with the sources behind each rule — typography rules by locale. To add one, see Contribute.
Manifesto
The em dash was mine before AI.
«—» is typography, not an AI watermark. Publishers set these marks by
locale-specific convention long before language models existed.
Read the manifesto.
Questions
Common questions
How do I turn straight quotes into curly quotes automatically?
Paste it into the playground, or call
transform(text, { locale }) from code. The
quotes rule picks each locale's pairs and
resolves nesting.
Which locales does polytypo support?
35 locales, each backed by cited style guides. See typography rules by locale.
Can it typeset Markdown, MDX, HTML and YAML without breaking code?
Yes. The markdown, html and yaml modes change only
prose and leave tags, attributes, code spans, code blocks and URLs alone. See
modes.
Is there a remark plugin for Markdown and MDX?
Yes. remark-polytypo on npm runs polytypo inside a unified or remark pipeline,
including MDX and Next.js. See
the remark plugin guide.
Does running it twice change the text again?
No. transform(transform(x)) equals transform(x) in every runtime;
see idempotency.
Is the em dash a sign of AI-written text?
No. It is standard punctuation in several style guides, and polytypo sets it only where a locale's guide prescribes it. Read the manifesto.
Already using polytypo? Add our badge
Two lines: a script tag and a span. No per-embed network call. Pick a language and a theme, then copy the code into your footer or credits. Embedding notes cover Content Security Policy. Sites with the badge are listed on Sites using polytypo.
<script async src="https://polytypo.dev/badge.js"></script>
<span data-polytypo-lang="en" data-polytypo-theme="light"></span>