Tools/shadcn-ui/cn

cn

cn is a new engine for Tailwind class merging and conflict resolution. It replaces tailwind-merge and clsx. Same APIs. Full parity. And it is 30× faster.

1.2kemergingTypeScriptMIT Licensenew this week

The Lens

By Erik Loyd, SaaS CEO and former COO/CFO of an AWS Premier Partner.

Updated Sep 2026

cn is a drop-in replacement for the two utilities almost every Tailwind project uses to build class names: tailwind-merge and clsx. Same APIs, same output, one dependency instead of two, and it is markedly faster (roughly 30x on the call your components make most, by its own benchmarks). Built by shadcn and Aiden Bai, MIT, zero dependencies.

If you have ever written a cn helper in a shadcn/ui project, this replaces the guts of it. It merges conflicting Tailwind classes and joins conditional ones, verified against tailwind-merge with hundreds of thousands of differential tests, so behavior matches. It is framework-agnostic (React, Vue, Svelte, Solid, Astro, plain templates) and runs anywhere JS runs. Migration is one CLI command or a two-line edit to your utils file.

For most projects this is an easy swap: less to ship, faster class merging, same behavior. The catch is that the win is real but small in absolute terms, class merging is rarely your bottleneck, so do not expect a visible speedup in a normal app. Two caveats: it needs Tailwind v4 (stay on tailwind-merge v2 for v3), and it is new, so the ecosystem trust that tailwind-merge earned over years is not there yet.

Free vs Self-Hosted vs Paid

fully free

Free: cn is MIT and fully open source. Install it from npm; there is no paid tier.

Self-hosted: Not applicable in the usual sense. It is a client/server JS library you add to your project and bundle; it runs wherever your code runs (browser, Node, Bun, Deno, edge).

Paid: None. It is a free, zero-dependency library.

Completely free and open source.

What to do by team size

Solo
free
Small team
free
Medium team
free
Large team
free
Self-hosting ops:trivial

Get tools like this every Wednesday

One featured tool, three on the radar. No fluff.

Score
73/100 · B+
Adoption12/30
Maintenance25/25
Community11/20
License15/15
Analysis10/10

A low score is not a verdict on quality. Young and niche tools start low by design. How we calculate scores

Trust Signals

Organization account (10 public repos)Notable author: 5,582 followersAuthor also built: shadcn-ui/chatbot-template (903 stars)

License: MIT License

Use freely, including commercial. Just keep the license.

Commercial use: ✓ Yes

About

Owner
shadcn-ui (Organization)
Stars
1,183
Forks
9

Also by shadcn-ui

Explore Further

More tools in the directory