TL;DR: Use text-{size} (e.g., text-sm to text-9xl) to quickly set font size. Use the / shorthand (e.g., text-lg/7) to set both size and line-height. Use arbitrary values like text-[18px] for precision. For a brand font scale, add --text-* variables to @theme (v4) or extend theme.fontSize (v3). For fluid resizing, use clamp() or a plugin.
1. What font sizes does Tailwind include? (px and rem table)
From text-xs (0.75 rem / 12px) up to text-9xl (8 rem / 128px) in default config.
Class | rem | px | Typical use |
|---|---|---|---|
text-xs | 0.75 | 12 | Captions, notes |
text-sm | 0.875 | 14 | UI labels |
text-base | 1 | 16 | Body copy |
text-lg | 1.125 | 18 | Dense body, sub-heading |
text-xl | 1.25 | 20 | Section heading |
text-2xl | 1.5 | 24 | Article title |
text-3xl | 1.875 | 30 | Hero subtitle |
text-4xl | 2.25 | 36 | Hero heading |
text-5xl | 3 | 48 | Landing hero |
text-6xl | 3.75 | 60 | Priority call-out |
text-7xl | 4.5 | 72 | Display headline |
text-8xl | 6 | 96 | Jumbo display |
text-9xl | 8 | 128 | Ultra display/splash |
2. What’s the fastest way to change font size in Tailwind?
Use utilities like text-sm, text-base, text-xl, up to text-9xl. They apply font-size (and default line-height) instantly.
<p class="text-base">Body text</p>
<h2 class="text-2xl">Section heading</h2> 3. How do you set size and line-height together?
Use the slash shorthand: text-lg/7, text-sm/6, etc. This sets both font-size and line-height in one class.
<p class="text-lg/7">Comfortable leading with size</p> 4. Can I use exact pixel/REM values in class names?
Yes, use arbitrary values like text-[18px] for precise control. You can also use CSS-variables via text-(length:--my-size).
<h3 class="text-[18px]">Exact 18px</h3>
<h3 class="text-(length:--hero-size)">Via CSS variable</h3> 5. How do I create a custom font scale?
In Tailwind v4, add --text-* variables to @theme in your CSS. Each size can also set its own line-height, letter-spacing and font-weight:
@import "tailwindcss";
@theme {
--text-tiny: 0.625rem;
--text-tiny--line-height: 1.5;
--text-hero: 3rem;
--text-hero--line-height: 1.05;
--text-hero--letter-spacing: -0.02em;
}This creates text-tiny and text-hero. On Tailwind v3, extend theme.fontSize in tailwind.config.js instead:
// tailwind.config.js
export default {
theme: {
extend: {
fontSize: {
tiny: ['0.75rem', { lineHeight: '1.1' }],
base: ['1rem', { lineHeight: '1.6' }],
hero: ['3rem', { lineHeight: '1.05', letterSpacing: '-0.02em' }],
},
},
},
} 6. What’s the best way to make font sizes responsive (fluid/clamp)?
Use clamp() in text-[…] utilities to scale font-size smoothly between a min & max viewport size. Alternatively use a fluid typography plugin.
<h1 class="text-[clamp(1.75rem,3vw,3rem)]">Fluid headline</h1> 7. What are practical size picks for headings, body and UI?
Body text:
text-base/7ortext-lg/7for comfortable readabilityH2 headings:
text-2xl/8 md:text-3xl/9H1:
text-4xl/none md:text-5xl/none(tightly spaced for display)Captions/UI hints:
text-xs/5
Pair these with your custom scale if you’ve defined one.
Explore real-world size usage in our UI Components page, grab ready sections from Free UI Sections, and get started quickly with Tailwind CSS CDN Setup (v4). Pair sizes with brand fonts in our Tailwind Custom Fonts guide, and polish headings with the Tailwind Box Shadow Generator.
FAQ
How do I quickly change font size in Tailwind?
Add `text-{size}` like `text-base`, `text-xl`, up to `text-9xl`.
How do I set size and line-height together?
Use `text-{size}/{lineHeight}` such as `text-lg/7`.
Can I use exact values like 18px?
Yes,`text-[18px]` or `text-(length:--my-size)` for CSS variables.
How do I make font sizes fluid?
Use `clamp(min, preferred, max)` inside `text-[…]` to scale with viewport.
How do I create a custom font scale?
In Tailwind v4, add --text-* variables to @theme in your CSS, for example --text-hero: 3rem; with --text-hero--line-height: 1.05;. In Tailwind v3, extend theme.fontSize in tailwind.config.js.




