
cnfast
Fast drop in replacement for `cn`
The Lens
By Erik Loyd, SaaS CEO and former COO/CFO of an AWS Premier Partner.
Updated Jun 2026
cnfast does the same job as the `cn` helper in every shadcn/ui project: it merges Tailwind class names so the right utility wins when two conflict (the thing that lets `p-2` and `p-4` resolve cleanly instead of fighting). It rolls clsx and tailwind-merge into one package and runs them faster, around 3.8x on average and up to 7x in component-heavy code, with byte-identical output. MIT-licensed, free, on npm.
Nothing to operate. It's a dependency. The speed comes from caching and a tagged-template syntax, and since the output matches tailwind-merge exactly, swapping it in is a find-and-replace on your import. There's a shadcn registry entry if you want it dropped straight into an existing project.
Solo: install it if className merging shows up in your render profiles, otherwise the default cn is fine. Small teams: low-risk swap, do it once and forget it. Large teams: the per-call savings add up across thousands of components, and the zero-breaking-change promise makes it an easy approval.
The catch: this solves a problem most apps don't have. className merge time is rarely your bottleneck, and adding a dependency to shave microseconds off something you never measured is premature optimization. Profile first. If clsx plus tailwind-merge isn't showing up, you don't need this.
Free vs Self-Hosted vs Paid
fully freeFree
The entire package. cnfast is MIT-licensed and published to npm. You get cn, clsx, twMerge, and twJoin exports, plus a shadcn/ui registry install. Byte-identical output to the tools it replaces.
Self-hosted
Not applicable. It's an npm dependency you bundle into your app.
Paid
None.
Free, MIT-licensed, and a one-command swap for the cn helper you already use.
What to do by team size
- Solo
- free
- Small team
- free
- Larger team
- free
Get tools like this every Wednesday
One featured tool, three on the radar. No fluff.
A low score is not a verdict on quality. Young and niche tools start low by design. How we calculate scores
Trust Signals
License: Other
Review license manually.
Commercial use: ✗ Restricted
About
- Owner
- Aiden Bai (User)
- Stars
- 1,173
- Forks
- 14
Explore Further
More tools in the directory
supermemory
Memory engine and app that is extremely fast, scalable. The Memory API for the AI era.
28.9k ★vue-pure-admin
全面ESM+Vue3+Vite+Element-Plus+TypeScript编写的一款后台管理系统(兼容移动端)
20.5k ★NotionNext
Turn your Notion workspace into a fast, customizable website. Built with Next.js + Notion API, with multi-platform deployment and no self-hosted server required.
11.7k ★