Skip to content
FluidClamp
Language: English

Tailwind clamp() Generator

Get fluid font sizes in Tailwind CSS without plugins. The calculator writes a text-[clamp(…)] class you can paste straight into your markup, plus a CSS variable for your theme.

Input unit
Output unit

Common presets

Your clamp() value

clamp(1.5rem, 1rem + 2.5vw, 3rem)

Slope: 2.5vw · Intercept: 1rem

Tailwind class
text-[clamp(1.5rem,1rem_+_2.5vw,3rem)]
CSS
clamp(1.5rem, 1rem + 2.5vw, 3rem)
CSS custom property
--fluid-size: clamp(1.5rem, 1rem + 2.5vw, 3rem);

Max is 2× the min – within the 2.5× guideline for WCAG SC 1.4.4 Resize Text.

Rendered size by viewport
ViewportSize (px)Size (rem)
320px241.5
375px25.381.5859
768px35.22.2
1024px41.62.6
1280px483
1440px483
1920px483

Your settings are saved in the URL, so you can bookmark or share this exact result.

Live preview

41.6px at a 1024px viewport

Fluid type grows smoothly with the screen.

Fluid sizes with Tailwind arbitrary values

Tailwind lets you put any CSS value in square brackets. Because spaces separate classes, spaces inside the value are written as underscores, which Tailwind converts back when it generates the CSS. The calculator handles this for you and produces a class like text-[clamp(1rem,0.8333rem_+_0.8333vw,1.5rem)]. The underscores around the plus sign matter: CSS requires whitespace around + and − inside math functions.

Putting it in your theme

Arbitrary classes are perfect for one-off headings. When the same size appears in many places, move it into your theme instead. In Tailwind v4, add a variable such as --text-fluid-lg: clamp(…) inside your @theme block and you can use text-fluid-lg everywhere. In Tailwind v3, add the value to theme.extend.fontSize in tailwind.config.js.

Keeping fluid sizes in the theme gives you one source of truth: if the design changes, you update one line and every component follows.

Spacing utilities

The same output works for spacing. Switch the calculator to spacing mode and it writes p-[clamp(…)], which you can rename to px-, py-, m-, gap- or space-y- as needed. Combine fluid spacing with fluid text and most pages need no responsive prefixes at all for size.

Common pitfalls

If a text-[…] class does nothing, check that the value contains no plain spaces and that Tailwind can see the full class name in your source files – class names built by string concatenation are not detected. If Tailwind treats the value as a color, write it as text-[length:clamp(…)] to state the type explicitly.

Frequently asked questions

Do I need a plugin for fluid type in Tailwind?

No. Arbitrary values support clamp() out of the box in Tailwind v3 and v4. Plugins only add naming conveniences.

Why are there underscores in the class?

Class names cannot contain spaces. Tailwind turns underscores into spaces when it builds the CSS, so the + inside clamp() gets the whitespace CSS requires.

How do I add a fluid size to the Tailwind v4 theme?

Inside @theme, declare --text-fluid-xl: clamp(…); Tailwind then generates a text-fluid-xl utility for you.

Does this work with responsive prefixes like md:?

Yes, but you rarely need them for size: a clamp() value already adapts to every viewport width.