Paste your Tailwind CSS utility classes and get them sorted in the recommended order — layout first, effects last. Supports single class strings or multi-element HTML snippets.
Related tools: CSS Variables Generator · CSS Media Query Generator
Input Mode
Paste a space-separated list of Tailwind utility classes.
Results
<div class="tw-diff" id="tw-diff-wrap">
<div class="tw-diff-box before">
<div class="tw-diff-label before">Before</div>
<div class="tw-diff-content" id="tw-before"></div>
</div>
<div class="tw-diff-box after">
<div class="tw-diff-label after">After</div>
<div class="tw-diff-content" id="tw-after"></div>
</div>
</div>
<label>Sorted Output</label>
<div class="tw-output-wrap">
<textarea class="tw-output" id="tw-output" readonly rows="5"></textarea>
<button class="tw-copy-btn" id="tw-copy-btn" onclick="twCopy()">Copy</button>
</div>
How the Sort Order Works
The sorter follows Tailwind’s recommended class ordering — the same order enforced by the official Prettier plugin for Tailwind CSS :
| Group | Examples |
|---|---|
| Layout | flex, grid, block, hidden, overflow-hidden |
| Positioning | relative, absolute, top-0, z-10 |
| Sizing | w-full, h-16, max-w-md |
| Spacing | p-4, mx-auto, space-x-2 |
| Typography | text-lg, font-bold, leading-tight, text-gray-900 |
| Backgrounds | bg-white, from-blue-500, bg-gradient-to-r |
| Borders | rounded-xl, border, ring-2 |
| Effects | shadow-lg, opacity-75 |
| Transitions | transition, duration-200, ease-in-out |
| Transforms | scale-95, rotate-3, translate-x-1 |
| Interactivity | cursor-pointer, select-none |
Responsive (sm:, md:, lg:) and state (hover:, focus:, dark:) variants are sorted after their base-class group.
Tips
- HTML mode is useful when you paste a full component — every
class="..."attribute is sorted independently. - Remove duplicates is on by default. Turn it off to see the full original class list sorted.
- The sorter works entirely in your browser — no data is sent anywhere.
Related tools: CSS Variables Generator · CSS Media Query Generator
