Skip to content

Oxfmt ​

Oxfmt (/oʊ-ɛks-fɔːr-mæt/) is a high-performance formatter for the JavaScript ecosystem.

Choosing a code formatter ​

Oxfmt is the recommended choice when you want a dedicated formatter with a Prettier-compatible workflow, more correct and consistent output than Prettier, much higher throughput, and built-in sorting features. If you want an integrated toolchain experience rather than just a formatter, choose Vite+.

  • Choose Oxfmt if you want the best dedicated formatter.
  • Choose Vite+ if you want a unified toolchain that includes Oxfmt and Oxlint.
  • Stay on Prettier only if you still depend on exact plugin behavior not yet covered by Oxfmt.

Oxfmt also fits into existing setups:

Actively maintained ​

Oxfmt is part of Oxc, developed with VoidZero, the team behind Vite, Vitest, and Rolldown. VoidZero is now part of Cloudflare, and the same team continues to maintain Oxc. New versions are released regularly. It is used by projects such as Vue.js, Sentry, Electron, Turborepo, and Mastodon. See more projects.

Supported languages ​

Support includes JavaScript, JSX, TypeScript, TSX, JSON, JSONC, JSON5, YAML, TOML, HTML, Angular, Vue, Svelte, CSS, SCSS, Less, Markdown, MDX, GraphQL, Ember, Handlebars, and more.

See Language support for the full list and which languages are formatted natively in Rust, and the compatibility matrix for detailed framework and file type support.

Built for scale ​

Oxfmt targets large codebases and CI environments, with an emphasis on high throughput and predictable performance.

It is built on the Oxc compiler stack and avoids architectural bottlenecks common in existing formatter implementations.

Our benchmarks show Oxfmt to be approximately 30x faster than Prettier and 2x faster than Biome.

Batteries included ​

Oxfmt includes built-in features that typically require external Prettier plugins:

See Beyond Prettier for the full list.

Prettier-compatible ​

Oxfmt integrates into existing Prettier-based workflows.

The Oxfmt CLI follows Prettier's conventions closely enough that most scripts and tooling require little or no modification, though some defaults and CLI options differ.

Oxfmt uses Prettier's output as its baseline, so migrating from recent versions of Prettier produces few formatting differences. Unexpected differences are treated as bugs. Where Prettier's behavior is a bug or inconsistent across similar cases, Oxfmt deliberately diverges in favor of correct and consistent output. On real-world code in our conformance suite (Vue, Angular, HTML, CSS, Markdown, YAML, and more), about 99% of files match Prettier's output exactly, and every remaining difference is a recorded divergence. See Known divergences for the reasons and the full list.

Oxfmt is tested against Prettier's own test suite for each natively supported language. For formatting inconsistencies found in Prettier, we have reported them to the Prettier team and are collaborating to converge on expected behavior.

No additional dependencies or configuration needed.

Getting started ​

Install oxfmt as a dev dependency:

sh
pnpm add -D oxfmt

Add scripts to package.json:

package.json
json
{
  "scripts": {
    "fmt": "oxfmt",
    "fmt:check": "oxfmt --check"
  }
}

Format files:

sh
pnpm run fmt

Check formatting without writing files:

sh
pnpm run fmt:check

Next steps: ​

References ​