oxfmt vs bun fmt: Two Prettier Ports, 702 Files, Only One Matched Prettier

📅 November 20, 2026 ⏱ 9 min read
oxfmt vs bun fmt: Two Prettier Ports, 702 Files, Only One Matched Prettier

The 60-second version of this test. Subscribe on YouTube

A week ago I put bun fmt against Prettier on TanStack Query and got identical output, 45x faster. While writing that one, I noticed TanStack Query itself doesn’t use Prettier anymore. It moved to oxfmt, the Rust formatter from the Oxc project, which ships a new release almost every week (0.79.0 came out on November 16).

So there are now two native “Prettier, but fast” formatters, and they make different promises. Bun says bun fmt is a drop-in that reads your .prettierrc. Oxfmt says it passes 100% of Prettier’s JavaScript and TypeScript conformance tests, but that it “uses Prettier’s output as its baseline” and “does not reproduce its bugs”.

If you’re leaving Prettier today, which one changes fewer lines of your code, and which one is faster? I ran both on the same 702 TypeScript files, diffed their output against Prettier 3.10.1, and timed them.

The Setup

  • Machine: a 4 vCPU cloud container (Intel Xeon @ 2.10 GHz, 15 GB RAM), Linux.
  • oxfmt: [email protected] from npm, run through its bin/oxfmt launcher on Node.js 22.23.5. That’s how most projects run it.
  • bun fmt: Bun 1.4.5 (1.4.5+a7733435c), the built-in bun fmt command.
  • Reference: [email protected] on the same Node. I also ran [email protected] as a cross-check.
  • The code: every tracked .ts and .tsx file in Excalidraw at commit 2c3dcc0 (November 19, 2026). That’s 702 files and 231,110 lines of a large React and TypeScript app. I copied the files into a clean folder with no config files, so each tool started from its own defaults.
  • Method: every timed run starts from a fresh copy of the folder, then os.sync() and a 2 second pause. There are 5 runs per tool and mode, interleaved across tools. I report the median wall-clock time and the peak memory (max RSS) of the process tree’s largest process, read from os.wait4() in a small Python harness.

The commands:

# Prettier 3.10.1 (reference)
prettier --write "**/*.{ts,tsx}"

# oxfmt 0.79.0
oxfmt .

# Bun 1.4.5
bun fmt .

Round 1: Default Options

Both tools say they’re Prettier-compatible, so the first test is the laziest one: install, run, no config.

$ diff -rq prettier-output/ bun-output/ | wc -l
0
$ diff -rq prettier-output/ oxfmt-output/ | wc -l
545

bun fmt produced the same bytes as Prettier in all 702 files. Oxfmt’s output differed in 545 of 702 files.

That isn’t a bug. It’s a documented default: oxfmt’s printWidth is 100, where Prettier’s is 80. The migration guide says so, and oxfmt --migrate prettier writes "printWidth": 80 into .oxfmtrc.json when your Prettier config doesn’t set it. But if you skip the migration command and just run oxfmt, you get a 545-file diff.

Oxfmt also doesn’t read .prettierrc at runtime. Its config is .oxfmtrc.json (or .oxfmtrc.jsonc, or oxfmt.config.ts). bun fmt reads your existing .prettierrc directly.

Round 2: Same Line Width

That’s a fair point against me, so I gave oxfmt the setting a migration would give it:

{ "printWidth": 80 }

Then I ran it again on the original files:

$ diff -rq prettier-output/ oxfmt-80-output/ | wc -l
43

Down to 43 files and 70 changed hunks. To check that this wasn’t a Prettier 3.10 regression, I formatted the same files with Prettier 3.9.10. Its output was identical to 3.10.1, so the 43 files are oxfmt-specific. Here’s what the 70 hunks are:

Kind of differenceHunksFiles
Union types5638
if (!(...)) conditions66
Other (a member chain, a comment, a callback with a comment-only deps array)83

Some files have more than one kind, so the file counts add up to more than 43.

Union types: a deliberate hold

Most of the gap is this one construct, from packages/common/src/utils.ts:

// Prettier 3.10.1 and bun fmt 1.4.5
export const isWritableElement = (
  target: Element | EventTarget | null,
): target is
  HTMLInputElement | HTMLTextAreaElement | HTMLBRElement | HTMLDivElement => {

// oxfmt 0.79.0 (printWidth 80)
export const isWritableElement = (
  target: Element | EventTarget | null,
): target is
  | HTMLInputElement
  | HTMLTextAreaElement
  | HTMLBRElement
  | HTMLDivElement => {

Prettier 3.9 changed how a too-long union breaks. It first tries to fit the whole union flat on the next indented line, and only then splits it into one | member per line. Oxfmt doesn’t follow that. Its DIVERGENCES.md lists it as union-annotation-flat-retry, with the reason “style-hold”. It says community pushback on the 3.9 style put following it on hold, so oxfmt “deliberately matches Prettier 3.8’s output for this construct”.

So 56 of the 70 hunks are a choice, not a bug. Whether it’s the right choice is taste. Personally I find the one-member-per-line version easier to scan in a diff.

Negated conditions

The second pattern, from packages/element/src/store.ts:

// Prettier 3.10.1 and bun fmt 1.4.5
if (!(
  this.scheduledMacroActions.size >= 0 &&
  this.scheduledMacroActions.size <= Object.keys(CaptureUpdateAction).length
)) {

// oxfmt 0.79.0 (printWidth 80)
if (
  !(
    this.scheduledMacroActions.size >= 0 &&
    this.scheduledMacroActions.size <=
      Object.keys(CaptureUpdateAction).length
  )
) {

Prettier now hugs !( against the if (. Oxfmt keeps the older shape. I didn’t find this one listed in DIVERGENCES.md, so I can’t tell you whether it’s intentional.

One more detail: Excalidraw’s own source is still formatted with Prettier 2.6.2, and in both patterns oxfmt’s output is what’s already in the repo. If you’re coming from an older Prettier, oxfmt will churn fewer lines than Prettier 3.10 would. On this repo, oxfmt with printWidth: 80 changed 106 files, while Prettier 3.10.1 and bun fmt each changed 130.

Round 3: Speed

Same files, same machine. “Write” formats the original files. “Check” runs on files that are already in Prettier 3.10 format. “1 core” pins the process to one CPU with taskset -c 0, and also passes --threads=1 to oxfmt.

Run (median of 5)Prettier 3.10.1oxfmt 0.79.0bun fmt 1.4.5
Write, 4 cores11.16 s0.218 s0.091 s
Write, 1 core22.55 s0.464 s0.249 s
Check, 4 cores11.46 s0.203 s0.068 s
Peak memory, write317 MB134 MB45 MB

Both are in a different league from Prettier: oxfmt is about 51x faster on 4 cores, and bun fmt is about 123x. Between the two, bun fmt was 2.4x faster on 4 cores and used a third of the memory.

Part of oxfmt’s time isn’t formatting. Its own summary line said Finished in 91ms on 703 files using 4 threads (703 because it counts its own config file), and oxfmt --version alone took 94 ms, because the npm package starts Node and then loads the native binding. bun fmt is one native binary with no JavaScript startup, and reported about 67 ms for the format itself. The Oxc docs mention a standalone binary too, which I didn’t test. If you run oxfmt from an editor through oxfmt --lsp, the startup happens once and disappears.

The oxfmt “check” run exits with code 1 on this tree, because of the 43 files from Round 2. In CI, that’s a failed build until you either reformat with oxfmt or stay with a Prettier-identical formatter.

The Comparison

oxfmt 0.79.0bun fmt 1.4.5
Matches Prettier 3.10.1, defaults157 of 702 files702 of 702 files
Matches Prettier 3.10.1, printWidth: 80659 of 702 files702 of 702 files
Write 702 files, 4 cores0.218 s0.091 s
Peak memory134 MB45 MB
Reads .prettierrcNo (--migrate prettier converts it)Yes
Installnpm package with a native bindingBuilt into Bun
Extra featuresImport sorting, Tailwind class sorting, package.json sorting, LSPPrettier options only
Published compatibility dataDIVERGENCES.md per language, case by caseRelease notes: 9,648 of 9,731 Prettier tests
StatusBeta (since February 2026), 0.x releasesShipped in Bun 1.4.4 (October 2026)

Where bun fmt Wins

  • Zero-diff migration. On this codebase it produced exactly what Prettier 3.10.1 produced, with no config at all. That’s the second real repo in two weeks where I’ve seen that.
  • Speed and memory. It was 2.4x faster than oxfmt and used a third of the memory, mostly because there’s no Node process in front of it.
  • No new config file. It reads the .prettierrc you already have.

Where oxfmt Wins

  • You don’t run Bun. Oxfmt is an npm package that works with any Node, pnpm or Yarn setup. bun fmt means putting Bun on every dev machine and CI runner.
  • You want more than Prettier. Oxfmt has built-in import sorting, Tailwind class sorting and package.json sorting. With Prettier, those are separate plugins.
  • You’d rather not have Prettier 3.9’s union style. If the flat-union-on-the-next-line output bothers you, oxfmt keeps the 3.8 style on purpose, and documents it.
  • You already use Oxlint. It’s the same project and the same release train. TanStack Query already made that switch.

Decision Table

Your situationPick
You want to drop Prettier with no diff at allbun fmt
Your team already runs Bunbun fmt
Node-only repo, no Bun anywhereoxfmt (with oxfmt --migrate prettier first)
You want import or Tailwind sorting without pluginsoxfmt
You’re still on Prettier 2.x and want minimal churnoxfmt, it changed 106 files here against 130 for Prettier 3.10
You rely on custom Prettier pluginsPrettier, for now

The Verdict

bun fmt wins this clash. On 702 real TypeScript files from Excalidraw, it matched Prettier 3.10.1 byte for byte with zero config. It was also 2.4x faster than oxfmt and used a third of the memory.

Oxfmt lost on fidelity, but it lost honestly. One gap is a default you fix with one line of config (printWidth: 80). Most of the remaining 43 files come from a style decision it documents in public. If you don’t run Bun, or you want import sorting built in, oxfmt is the better tool. Just run oxfmt --migrate prettier first, and expect a one-time diff in your union types.

Caveats: one repo, TypeScript only, one 4-core machine, five runs per measurement. I didn’t test CSS, Markdown, Vue or Svelte files, or Prettier plugins. Before you switch, copy your repo, run both formatters, and diff -rq the folders against Prettier. On Excalidraw, the whole comparison took less time than one Prettier run.


More TypeScript tooling clashes:

💡

Enjoying the content? Here are tools I personally use and recommend:

  • 🌐 Hosting: Bluehost — simple hosting for a WordPress or PHP site
  • 🛒 Tech Gear: My Amazon Store — keyboards, monitors, dev tools I use

Purchases through my links help keep this blog ad-free 💙

Enjoyed this post?

Every clash gets a video: two tools, one real task, a measured winner.

▶ Subscribe on YouTube 🎬 All videos