CSS units converter: px to rem, fluid clamp() font sizes and a type scale
Three small helpers for everyday CSS work: a px and rem converter, a fluid size generator and a modular type scale.
- Free, no sign-up
- Your files and data stay on your device
- No watermarks or limits
0 bytes uploaded. Everything happens in this tab.
How to use it
- Pick a mode: px / rem, Fluid size (clamp) or Type scale.
- Fill in the fields, for example Value and Root font size (px), or the minimum and maximum size with the smallest and largest screen width.
- Copy the single value, the clamp() declaration or the list of CSS variables.
Example
Fluid size from 16px to 32px between 320px and 1280px screens:
font-size: clamp(1rem, 0.6667rem + 1.6667vw, 2rem); (24px at an 800px wide screen)
About this tool
Rem is a unit relative to the root font size, which browsers set to 16px by default, so 24px is 1.5rem. Sizing text and spacing in rem lets people who change their default font size see the page scale with it. In the px / rem mode you can set a different Root font size (px) if your project changes it, and a table next to the result lists common pixel sizes converted with that base.
The Fluid size (clamp) mode creates font-size: clamp(min, preferred, max). The preferred part is a straight line in rem and vw, so the size grows smoothly from your minimum at the smallest screen width to your maximum at the largest, and stays fixed outside that range. A small table shows the size at the two ends and in the middle. The Type scale mode multiplies a base size by a ratio, such as major third (1.25) or golden ratio (1.618), for the number of steps up and down you choose, and writes variables named --step-0, --step-1 and so on; negative steps appear as --step--1.
A few cautions. The fluid line is a linear interpolation of the viewport width only, so check the result in a browser at several widths. Test the result with the browser text size set larger as well. Pick the root font size to match your own stylesheet, not the default blindly. Calculations run in your browser and nothing is uploaded.
Frequently asked questions
How do I convert 24px to rem?
Divide by the root font size. With the default 16px, 24px is 1.5rem. Change the Root font size (px) field if your project uses another base.
What does clamp() do?
clamp(min, preferred, max) uses the preferred value but never goes below the minimum or above the maximum, so the text scales smoothly and stops at the limits.
Why does the fluid formula use rem and vw together?
The rem part keeps the size responsive to the user font setting, and the vw part makes it follow the screen width.
What is a type scale?
A set of font sizes where each step is the previous one multiplied by a fixed ratio, which gives headings and text a consistent rhythm.
Is this uploaded anywhere?
No, all calculations happen locally.