<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Coder Legion - Recent posts tagged formatter</title>
<link>https://coderlegion.com/tag/formatter</link>
<description>Powered by Question2Answer</description>
<item>
<title>Oxfmt: The Prettier Compatible Formatter That's 30x Faster</title>
<link>https://coderlegion.com/11839/oxfmt-the-prettier-compatible-formatter-thats-30x-faster</link>
<description>&lt;p&gt;Remember &lt;a rel=&quot;nofollow&quot; href=&quot;https://coderlegion.com/11628/oxlint-js-linter-thats-actually-fast-enough-to-matter&quot;&gt;Part 1&lt;/a&gt; where we talked about Oxlint being stupidly fast? Well, buckle up because Oxfmt (the formatter) is even more ridiculous.&lt;/p&gt;
&lt;p&gt;We're talking 30x faster than Prettier. Not a typo. Thirty times.&lt;/p&gt;
&lt;p&gt;But speed isn't everything. Prettier works. It's stable. It's everywhere. So the real question isn't &quot;is Oxfmt fast?&quot; it's &quot;is it fast enough to justify the risk of switching?&quot;&lt;/p&gt;
&lt;p&gt;Let's find out.&lt;/p&gt;
&lt;h3 id=&quot;what-is-oxfmt-&quot;&gt;What Is Oxfmt?&lt;/h3&gt;
&lt;p&gt;Oxfmt is a code formatter built by the same VoidZero team that made Oxlint. Written in Rust, runs on the Oxc parser (same one Oxlint uses), and targets 95%+ compatibility with Prettier.&lt;/p&gt;
&lt;p&gt;Key phrase: &lt;strong&gt;targets compatibility&lt;/strong&gt;. Not &quot;reinvents formatting&quot; like Biome. Not &quot;has its own opinions&quot; like dprint. Oxfmt's goal is to be Prettier, but faster.&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://oxc.rs/blog/2025-12-01-oxfmt-alpha&quot;&gt;Announced in December 2025&lt;/a&gt;, currently in alpha. Early, but with receipts.&lt;/p&gt;
&lt;h3 id=&quot;the-performance-numbers-with-sources-&quot;&gt;The Performance Numbers (With Sources)&lt;/h3&gt;
&lt;p&gt;All numbers from &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/oxc-project/bench-formatter&quot;&gt;Oxc's official formatter benchmark repo&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Large single file (TypeScript compiler's parser.ts, ~540KB):&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;oxfmt:                  104ms
Biome:                  136ms (1.3x slower)
prettier+oxc-parser:    710ms (6.8x slower)
prettier (default):     1.04s (10x slower)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Mixed repository (Storybook):&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;oxfmt:              16.6s
prettier+oxc:       40.2s (2.4x slower)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Full features (Continue repository):&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;oxfmt:              9.2s
prettier+oxc:       56.8s (6.2x slower)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Memory usage (Outline benchmark):&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;prettier:       223.9 MB
oxfmt:          152.9 MB
Biome:          62.2 MB  ← Biome wins here
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Worth noting: Biome is significantly more memory-efficient. Oxfmt is faster, but Biome is leaner. &lt;a rel=&quot;nofollow&quot; href=&quot;https://oxc.rs/docs/guide/benchmarks&quot;&gt;Official benchmarks&lt;/a&gt; put Oxfmt at roughly &lt;strong&gt;30x faster than Prettier&lt;/strong&gt; and &lt;strong&gt;3x faster than Biome&lt;/strong&gt; on initial runs without cache.&lt;/p&gt;
&lt;h3 id=&quot;but-is-it-actually-compatible-&quot;&gt;But Is It Actually Compatible?&lt;/h3&gt;
&lt;p&gt;This is the million-dollar question. If Oxfmt formats your code differently, migration becomes a nightmare of diffs.&lt;/p&gt;
&lt;p&gt;Good news: &lt;a rel=&quot;nofollow&quot; href=&quot;https://oxc.rs/blog/2025-12-01-oxfmt-alpha&quot;&gt;Oxfmt passes ~95% of Prettier's JS/TS test suite&lt;/a&gt;. The remaining 5%? Some of it is intentional.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example — array formatting consistency:&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-javascript&quot;&gt;// Prettier (inconsistent)
const longer = [
  'item1', 'item2', 'item3' // breaks despite fitting
];

// Oxfmt (consistent)
const longer = ['item1', 'item2', 'item3']; // stays inline if it fits
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The team is even &lt;a rel=&quot;nofollow&quot; href=&quot;https://voidzero.dev/posts/announcing-oxfmt-alpha&quot;&gt;submitting PRs to Prettier&lt;/a&gt; to converge on these edge cases, some landed in Prettier 3.7.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;⚠️ Critical gotcha:&lt;/strong&gt; Oxfmt defaults to &lt;code&gt;printWidth: 100&lt;/code&gt;. Prettier defaults to &lt;code&gt;80&lt;/code&gt;. Migrate without setting this and you'll get massive diffs everywhere.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-json&quot;&gt;// .oxfmtrc.jsonc — set this FIRST
{
  &quot;$schema&quot;: &quot;./node_modules/oxfmt/configuration_schema.json&quot;,
  &quot;printWidth&quot;: 80
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;feature-comparison&quot;&gt;Feature Comparison&lt;/h3&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;&lt;th&gt;Feature &lt;/th&gt;&lt;th&gt;Oxfmt (Alpha) &lt;/th&gt;&lt;th&gt;Prettier 3.7 &lt;/th&gt;&lt;th&gt;Biome 2.0&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Speed&lt;/strong&gt; &lt;/td&gt;&lt;td&gt;30x faster &lt;/td&gt;&lt;td&gt;Baseline &lt;/td&gt;&lt;td&gt;3x faster&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Prettier compatibility&lt;/strong&gt; &lt;/td&gt;&lt;td&gt;95%+ &lt;/td&gt;&lt;td&gt;100% &lt;/td&gt;&lt;td&gt;~70%&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;JS/TS/CSS/HTML&lt;/strong&gt; &lt;/td&gt;&lt;td&gt;✅ &lt;/td&gt;&lt;td&gt;✅ &lt;/td&gt;&lt;td&gt;✅&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Tailwind class sorting&lt;/strong&gt; &lt;/td&gt;&lt;td&gt;Built-in ✅ &lt;/td&gt;&lt;td&gt;Plugin &lt;/td&gt;&lt;td&gt;❌&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Import sorting&lt;/strong&gt; &lt;/td&gt;&lt;td&gt;Coming &lt;/td&gt;&lt;td&gt;Plugin &lt;/td&gt;&lt;td&gt;Built-in ✅&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Vue/Svelte/Astro&lt;/strong&gt; &lt;/td&gt;&lt;td&gt;Roadmap &lt;/td&gt;&lt;td&gt;Plugins &lt;/td&gt;&lt;td&gt;❌&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Plugin support&lt;/strong&gt; &lt;/td&gt;&lt;td&gt;Roadmap &lt;/td&gt;&lt;td&gt;✅ &lt;/td&gt;&lt;td&gt;❌&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Memory usage&lt;/strong&gt; &lt;/td&gt;&lt;td&gt;152 MB &lt;/td&gt;&lt;td&gt;224 MB &lt;/td&gt;&lt;td&gt;62 MB&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Production ready&lt;/strong&gt; &lt;/td&gt;&lt;td&gt;No (alpha) &lt;/td&gt;&lt;td&gt;Yes &lt;/td&gt;&lt;td&gt;Yes&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Oxfmt's built-in Tailwind class sorting is a big deal if you're on Tailwind, no &lt;code&gt;prettier-plugin-tailwindcss&lt;/code&gt; needed. But no Vue/Svelte/Astro support yet, and no plugin system. Both are on the beta roadmap.&lt;/p&gt;
&lt;h3 id=&quot;migration-strategies&quot;&gt;Migration Strategies&lt;/h3&gt;
&lt;h4 id=&quot;option-1-full-replace&quot;&gt;Option 1: Full Replace&lt;/h4&gt;
&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; JS/TS-only projects, no Prettier plugins, willing to be early adopters&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;npm install -D oxfmt
npx oxfmt --migrate=prettier  # Auto-converts your Prettier config
npx oxfmt .
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Trade-offs:&lt;/strong&gt; 30x faster, built-in Tailwind sorting, 95% compatible, but alpha bugs exist, no plugins, no Vue/Svelte formatters.&lt;/p&gt;
&lt;h4 id=&quot;option-2-hybrid-local-speed-ci-safety-&quot;&gt;Option 2: Hybrid (Local Speed, CI Safety)&lt;/h4&gt;
&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; Teams that want fast local formatting but aren't ready to commit&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-json&quot;&gt;{
  &quot;scripts&quot;: {
    &quot;format&quot;: &quot;oxfmt .&quot;,
    &quot;format:ci&quot;: &quot;prettier --check .&quot;
  }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Run Oxfmt locally for instant feedback. Keep Prettier in CI as a safety net. Slightly wasteful running both, but it de-risks the migration considerably.&lt;/p&gt;
&lt;h4 id=&quot;option-3-wait-for-beta-q1-2026-&quot;&gt;Option 3: Wait for Beta (Q1 2026)&lt;/h4&gt;
&lt;p&gt;Honestly the right call for most teams. &lt;a rel=&quot;nofollow&quot; href=&quot;https://voidzero.dev/posts/announcing-oxfmt-alpha&quot;&gt;The team has been upfront&lt;/a&gt;: &lt;em&gt;&quot;Oxfmt is in alpha and may not suit complex setups.&quot;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Beta is targeting Q1 2026 with import sorting, Vue/Svelte/Astro support, and a plugin system. If you're not hitting CI pain right now, wait.&lt;/p&gt;
&lt;h3 id=&quot;common-pitfalls&quot;&gt;Common Pitfalls&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;printWidth&lt;/code&gt; mismatch:&lt;/strong&gt; The single biggest migration trap. Always set &lt;code&gt;printWidth: 80&lt;/code&gt; explicitly if migrating from Prettier.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Prettier plugins:&lt;/strong&gt; &lt;code&gt;prettier-plugin-organize-imports&lt;/code&gt;, &lt;code&gt;@trivago/prettier-plugin-sort-imports&lt;/code&gt;, and similar won't work. Plugin system is on the beta roadmap.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Vue/Svelte/Astro files:&lt;/strong&gt; Oxfmt skips them silently. Keep Prettier for those files until framework support lands.&lt;/p&gt;
&lt;h3 id=&quot;when-should-you-use-it-&quot;&gt;When Should You Use It?&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Choose Oxfmt if:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;You need maximum speed (30x faster)&lt;/li&gt;
&lt;li&gt;You use Tailwind heavily (built-in class sorting, no plugin needed)&lt;/li&gt;
&lt;li&gt;You only format JS/TS/CSS/HTML&lt;/li&gt;
&lt;li&gt;You're okay with alpha software and willing to file issues&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Stick with Prettier if:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;You rely on plugins (import sorters, framework formatters)&lt;/li&gt;
&lt;li&gt;You need proven stability&lt;/li&gt;
&lt;li&gt;Your pre-commit hooks run on thousands of files daily (alpha bugs = blocked commits)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Consider Biome if:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;You want one unified tool for linting + formatting&lt;/li&gt;
&lt;li&gt;Memory efficiency matters to you&lt;/li&gt;
&lt;li&gt;You need stable Rust-based tooling today&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;the-bigger-picture-full-oxc-stack&quot;&gt;The Bigger Picture: Full Oxc Stack&lt;/h3&gt;
&lt;p&gt;If you go all-in on Oxc, your entire pipeline shares the same parser. Lint and format without parsing your code twice.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-json&quot;&gt;// package.json
{
  &quot;scripts&quot;: {
    &quot;lint&quot;: &quot;oxlint&quot;,
    &quot;format&quot;: &quot;oxfmt&quot;,
    &quot;check&quot;: &quot;oxlint &amp;amp;&amp;amp; oxfmt --check&quot;
  }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;VoidZero's vision: &lt;em&gt;&quot;One toolchain for parse, lint, format, transform, bundle.&quot;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Not fully there yet, Oxfmt is alpha, Rolldown is still in development. But the direction is clear.&lt;/p&gt;
&lt;h3 id=&quot;the-honest-take&quot;&gt;The Honest Take&lt;/h3&gt;
&lt;p&gt;Oxfmt is impressive. 30x faster than Prettier is real. Built-in Tailwind sorting removes a dependency. 95% compatibility makes migration feasible without a giant diff.&lt;/p&gt;
&lt;p&gt;But it's alpha. If you're on a greenfield project and comfortable filing GitHub issues, try it. If you're running a production app with dozens of engineers, wait for beta. If Prettier works fine and CI isn't painful, there's genuinely no reason to change. Being boring with tooling is underrated.&lt;/p&gt;
&lt;p&gt;The best formatter is the one that gets out of your way.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;Try it yourself:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://oxc.rs/docs/guide/usage/formatter&quot;&gt;Oxfmt docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/oxc-project/bench-formatter&quot;&gt;Official benchmarks&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://oxc.rs/blog/2025-12-01-oxfmt-alpha&quot;&gt;Alpha announcement&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://oxc.rs/docs/guide/usage/formatter/migrate-from-prettier&quot;&gt;Migration guide&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Questions? Hit bugs? Found edge cases?&lt;/strong&gt; Drop them in the comments, community feedback shapes these tools early on.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Missed Part 1?&lt;/strong&gt; Go read the &lt;a rel=&quot;nofollow&quot; href=&quot;https://coderlegion.com/11628/oxlint-js-linter-thats-actually-fast-enough-to-matter&quot;&gt;Oxlint deep dive&lt;/a&gt; on why it's 50-100x faster than ESLint and when you should actually care.&lt;/p&gt;
</description>
<category>Tutorials</category>
<guid isPermaLink="true">https://coderlegion.com/11839/oxfmt-the-prettier-compatible-formatter-thats-30x-faster</guid>
<pubDate>Tue, 17 Feb 2026 13:40:46 +0000</pubDate>
</item>
</channel>
</rss>