Tailwind Class Sorter
Sort Tailwind classes and detect conflicting utilities with a winner explanation.
OpenConvert design file pixels to rem, or rem back to pixels, against whatever root size your project uses.
Keep 16 px or enter the html font size your project uses.
Enter a value in either field; the other updates instantly.
A line below confirms the conversion and the root used.
Drop trailing zeros and use the value in your stylesheet.
The design file specifies a 22 px heading and 14 px body text, but the codebase uses rem everywhere so text respects browser font settings. Dividing by 16 in your head gets old fast, and some projects set the root to 10 px instead. Enter the value and read the conversion.
There are three fields: the root font size (16 px by default), a px value and a rem value. Type in the px field and the rem field fills in, to four decimal places. Type in the rem field and the px value appears, to two decimal places. Changing the root recalculates from the current pixel value. A line underneath states the conversion in words, for example 24px = 1.5000rem (root 16px), which is handy for checking your own maths.
The root size should match the computed font size of the html element in your project. If your CSS sets html { font-size: 62.5% }, use 10 as the root so 1.6rem equals 16 px. Be careful with that pattern, though; it changes the base size for every component and third-party widget on the page. Use rem for font sizes and most spacing, and keep px for hairline borders that should not scale. Trim the trailing zeros when you paste the value into CSS. For fluid sizes that grow between two rem values, plug the results into the clamp() and breakpoint starter. Spacing classes built from one value come from the spacing utility generator.
Keyboard shortcut
Answers for this tool. For site-wide help, open the FAQ hub.
rem is relative to the root html font size, so it is the same everywhere on the page. em is relative to the font size of the current element, so it compounds when elements are nested.
The browser uses the computed html font size, which the user may have changed in settings. The converter assumes the root you entered, so 1rem only equals 16 px at the default setting.
No, it converts one value at a time. For a list, keep the root fixed and type each value in turn; the result updates on every keystroke.