Reference · 8 min read
Tailwind CSS Cheat Sheet 2026
A quick-reference guide to the most useful Tailwind CSS utility classes. Bookmark this page for fast access while building your next project. Covers Tailwind CSS v4 (released 2025).
Responsive Breakpoints
All Tailwind utilities can be prefixed with a breakpoint to apply them conditionally. Tailwind is mobile-first — unprefixed classes apply to all screen sizes.
| Prefix | Min Width | Example |
|---|---|---|
| sm: | 640px | sm:text-lg |
| md: | 768px | md:grid-cols-2 |
| lg: | 1024px | lg:px-16 |
| xl: | 1280px | xl:max-w-screen-xl |
| 2xl: | 1536px | 2xl:text-6xl |
Spacing (Padding & Margin)
Tailwind uses a 4px base unit. p-1 = 4px, p-4 = 16px, p-8 = 32px.
Padding
p-{n}Padding all sidespx-{n}Horizontal paddingpy-{n}Vertical paddingpt-{n}Padding toppb-{n}Padding bottompl-{n}Padding leftpr-{n}Padding rightps-{n}Padding inline-start (RTL-aware)Margin
m-{n}Margin all sidesmx-{n}Horizontal marginmy-{n}Vertical marginmx-autoCenter horizontallymt-{n}Margin topmb-{n}Margin bottom-mt-{n}Negative margin topspace-x-{n}Gap between flex children (horizontal)Flexbox
Container
flexDisplay flexinline-flexInline flex containerflex-rowDirection: row (default)flex-colDirection: columnflex-wrapWrap items to next lineflex-nowrapPrevent wrappingAlignment
items-startAlign items: flex-startitems-centerAlign items: centeritems-endAlign items: flex-endjustify-startJustify: flex-startjustify-centerJustify: centerjustify-endJustify: flex-endjustify-betweenJustify: space-betweenjustify-aroundJustify: space-aroundChildren
flex-1Grow and shrink as neededflex-autoGrow and shrink based on contentflex-nonePrevent grow/shrinkshrink-0Never shrinkgap-{n}Gap between itemsorder-{n}Reorder itemsCSS Grid
Grid Container
gridDisplay gridgrid-cols-{n}Number of columns (1–12)grid-rows-{n}Number of rowsgap-{n}Gap between rows and columnsgap-x-{n}Column gap onlygap-y-{n}Row gap onlycol-span-{n}Span n columnsrow-span-{n}Span n rowsTypography
Font Size
text-xs12pxtext-sm14pxtext-base16px (default)text-lg18pxtext-xl20pxtext-2xl24pxtext-3xl30pxtext-4xl36pxtext-5xl48pxtext-6xl60pxFont Weight
font-thinweight: 100font-lightweight: 300font-normalweight: 400font-mediumweight: 500font-semiboldweight: 600font-boldweight: 700font-extraboldweight: 800font-blackweight: 900Text Alignment & Decoration
text-leftAlign lefttext-centerAlign centertext-rightAlign rightunderlineUnderline textline-throughStrikethroughuppercaseUppercase transformcapitalizeCapitalize first lettertracking-wideLetter spacing widerleading-relaxedLine height 1.625truncateTruncate with ellipsisColors
Tailwind includes a full color palette from 50 (lightest) to 950 (darkest). Available for text, background, border, and more.
Common Usage
text-gray-900Dark texttext-gray-600Secondary texttext-whiteWhite textbg-whiteWhite backgroundbg-gray-50Light gray backgroundbg-cyan-700Brand color backgroundborder-gray-200Light borderborder-cyan-300Accent borderSizing (Width & Height)
Width
w-full100% widthw-screen100vww-{n}Fixed width (4px units)w-1/250% widthw-1/333.33% widthw-autoAuto widthmax-w-smMax width 384pxmax-w-xlMax width 576pxmax-w-4xlMax width 896pxmax-w-screen-xlMax width 1280pxHeight
h-full100% heighth-screen100vhh-{n}Fixed height (4px units)h-autoAuto heightmin-h-screenMin height: 100vhmax-h-96Max height 384pxBorders & Rounded Corners
Borders
border1px borderborder-22px borderborder-tTop border onlyborder-bBottom border onlyborder-gray-200Border colordivide-yBorders between childrenBorder Radius
rounded0.25rem border radiusrounded-md0.375remrounded-lg0.5remrounded-xl0.75remrounded-2xl1remrounded-fullFully rounded (pills, circles)Shadows & Effects
Box Shadow
shadow-smSmall shadowshadowDefault shadowshadow-mdMedium shadowshadow-lgLarge shadowshadow-xlExtra large shadowshadow-noneRemove shadowOpacity & Visibility
opacity-0Fully transparentopacity-5050% opacityopacity-100Fully visiblehiddendisplay: noneinvisiblevisibility: hiddenoverflow-hiddenClip overflowPosition & Z-Index
Position
staticDefault flow positionrelativeRelative positionabsoluteAbsolute positionfixedFixed to viewportstickyStick on scrollinset-0top/right/bottom/left: 0top-0top: 0z-10z-index: 10z-50z-index: 50State Modifiers
Interactive States
hover:bg-gray-900On mouse hoverfocus:outline-noneOn focusactive:opacity-75On click/tapdisabled:opacity-50Disabled stategroup-hover:text-whiteWhen parent hovereddark:bg-gray-900Dark mode classtransition-colorsAnimate color changesduration-200Transition: 200msease-in-outEasing functionPut these classes to work with free Tailwind CSS components
Skip building from scratch. Copy-paste ready-made Tailwind CSS components into your project.