UTILITIES WORKSPACE

CSS Clamp Generator

Calculate fluid font-size CSS from two viewport widths and text sizes.

Input is processed on this site only when you run the tool. The application does not save inputs or results.

WORKBENCH css-clamp-generator Server

Configuration options

Set the viewport widths and font sizes in whole pixels.

Result result.css

A little clarity goes here.

Run the tool to see your result.

Awaiting a resultCSS
Ctrl ↵

Ready. Run explicitly; typing and pasting do not send requests.

UTF-8 text, at most 262144 bytes per input. Tab leaves the editor. Plain text disables syntax colors. Browser textareas may normalize line endings to LF.

A QUICK WALKTHROUGH

A familiar workflow,
with room to focus.

When to use CSS Clamp Generator

Create fluid font-size CSS between a known small-screen size and a larger-screen size without calculating the slope by hand.

Read the result

Copy the declaration and check the destination root font size. Endpoint specimens show the sizes you entered; rem conversion assumes the selected root, and rounded coefficients introduce a small tolerance.

SEE IT IN PRACTICE

Worked examples

Sample input. A result you can inspect.

Generate example
Minimum viewport (px)
360
Maximum viewport (px)
1440
Minimum font size (px)
16
Maximum font size (px)
32
Output unit
rem
Root font size (px)
16

Expected result

/* 16px at 360px → 32px at 1440px. */
/* rem conversion assumes a 16px root font size. */
font-size: clamp(1rem, calc(1.481481vw + 0.666667rem), 2rem);

Formats, limits and common errors

Use whole-pixel values in range, increase the maximum viewport, and keep the maximum font size at least as large as the minimum.

MDN CSS clamp() ↗ (opens in a new tab)

Find your tool

Use Tab or arrow keys to navigate

JSON Formatter & ValidatorJSONJSON MinifierJSONJSON CompareJSONURL Encoder / DecoderEncodingBase64 Encoder / DecoderEncodingHTML Entity Encoder / DecoderEncodingJWT DecoderSecurityHash GeneratorSecurityPassword GeneratorSecurityToken GeneratorSecurityWord & Character CounterTextUUID GeneratorUtilitiesUnix Timestamp ConverterUtilitiesXML to JSONJSONBcrypt Hash & VerifySecurityRegex TesterTextJSON to CSVJSONCSV to JSONJSONJSON Tree ViewerJSONCode & Text CompareTextURL ParserUtilitiesCron ExplainerUtilitiesColor ConverterUtilitiesJSONL ValidatorAI DevelopmentJSONL FormatterAI DevelopmentPrompt Template BuilderAI DevelopmentToken Count EstimatorAI DevelopmentText ChunkerAI DevelopmentRAG Chunking PreviewAI DevelopmentChat Messages JSON ValidatorAI DevelopmentAI Function / Tool Schema ValidatorAI DevelopmentPrompt Version ComparisonAI DevelopmentAI Request Payload FormatterAI DevelopmentJSON String Escape / UnescapeEncodingHMAC GeneratorSecurityQuery String ↔ JSONUtilitiesCSS Clamp GeneratorUtilities