Tailwind Arbitrary Value Map: Translate Pixel Sizes to Classes and Config
Paste a pixel size or a raw CSS block and instantly get native Tailwind utility classes, JIT bracket notation, and a copy-ready tailwind.config.js theme extension.
// Paste a CSS block above to generate your theme extension module.exports = { theme: { extend: { // custom values will appear here } } }
The Complete Guide to Tailwind Arbitrary Values and Config Extensions
Design files rarely match Tailwind's default spacing scale exactly. When a designer specifies padding-top: 22px or a custom card width of 347px, you have two clean options: use Tailwind's bracket notation for a one-off fix, or extend the config to make that value a first-class token your whole team can reference. This tool does the math and generates both for you instantly.
How to Use This Tool
In the Quick Single Value box, type any pixel number to immediately see its REM equivalent, its Tailwind spacing key (if one exists), and both the native class and JIT arbitrary class syntax for the spacing category.
In the Bulk CSS Parser, paste any raw CSS declarations exactly as they appear in a design spec or existing stylesheet. The tool parses every property-value pair in real time, maps each CSS property to its closest Tailwind utility prefix, and populates both the Translation Readout table and the config block below.
Use the Base Font Size control to adjust REM math if your project sets a different root font size (for example, some projects use 10px to make rem math simpler).
Understanding the Tailwind Default Spacing Scale
Tailwind's default spacing scale runs from 0 to 96, where each unit equals 0.25rem (4px at the default 16px root). The most commonly used values are: 1 = 4px, 2 = 8px, 4 = 16px, 6 = 24px, 8 = 32px, 12 = 48px, 16 = 64px, and so on. This tool highlights in green when your pixel value lands exactly on one of these native scale points.
Values that fall between scale points (like 10px or 22px) have no native class. The JIT arbitrary syntax handles these cleanly: p-[10px] or mt-[22px] compile to exact CSS with zero performance cost in Tailwind v3 and later.
When to Extend the Config vs. Use Bracket Notation
If a custom value appears more than two or three times in your project, adding it to tailwind.config.js pays off immediately. Named tokens like spacing.18 or fontSize.display are easier to search for, easier to update globally, and more readable for teammates who did not write the original code. Arbitrary bracket values are best for pixel-perfect design details that are truly one-off.
Mapping CSS Properties to Tailwind Prefixes
This tool maps the most common CSS sizing properties to their Tailwind counterparts: margin becomes m-, padding becomes p-, width becomes w-, height becomes h-, font-size becomes text-, border-radius becomes rounded-, and gap values map to gap-, gap-x-, or gap-y-. The config generator groups all spacing-related values under theme.extend.spacing and separates font sizes, line heights, and border radii into their own theme sections.
Frequently Asked Questions
w-[317px] sets width to exactly 317px, even though 317px is not part of the default spacing scale. This eliminates the need to write custom CSS for one-off values or to extend the config for minor deviations from the default scale.spacing.18 or fontSize.display. Extending the config keeps your markup cleaner and your design tokens centralized.tailwind.config.js file, add your custom values under theme.extend.spacing to merge them with the default scale without replacing it. For example: theme: { extend: { spacing: { '18': '72px' } } }. After adding the config, you can use classes like mt-18 or p-18 in your templates. If you use theme.spacing instead of theme.extend.spacing, you replace the entire default scale, which removes built-in classes like p-4 and mt-8.bg-[#1a2b3c] for a custom hex color, text-[clamp(1rem,2.5vw,2rem)] for fluid typography, shadow-[0_4px_24px_rgba(0,0,0,0.15)] for custom box shadows, and grid-cols-[1fr_2fr_1fr] for custom grid templates. The bracket notation passes the value directly to the underlying CSS property, so anything valid in CSS is valid here.