WordPress theme.json Generator
Build a version 3 theme.json and see which half of it changes your site
Runs in your browser. Nothing is uploaded.
About the WordPress theme.json Generator
Generate a theme.json for a WordPress block theme: layout widths, a colour palette, font sizes with fluid typography, spacing and global styles.
Worked example: the default output
Settings (the defaults)
Content width (px): 640
Wide width (px): 1200
Contrast (text): #111111
Base (background): #ffffff
Accent (links): #4c6ef5
Fluid typography: on
appearanceTools: on
Also apply the styles: on
Spacing scale: off Generated theme.json
{
"$schema": "https://schemas.wp.org/trunk/theme.json",
"version": 3,
"settings": {
"appearanceTools": true,
"layout": {
"contentSize": "640px",
"wideSize": "1200px"
},
"color": {
"defaultPalette": false,
"palette": [
{
"slug": "base",
"color": "#ffffff",
"name": "Base"
},
{
"slug": "contrast",
"color": "#111111",
"name": "Contrast"
},
{
"slug": "accent",
"color": "#4c6ef5",
"name": "Accent"
}
]
},
"typography": {
"defaultFontSizes": false,
"fluid": true,
"fontSizes": [
{
"slug": "small",
"name": "Small",
"size": "0.875rem"
},
{
"slug": "medium",
"name": "Medium",
"size": "1.125rem",
"fluid": {
"min": "1rem",
"max": "1.125rem"
}
},
{
"slug": "large",
"name": "Large",
"size": "2.25rem",
"fluid": {
"min": "1.5rem",
"max": "2.25rem"
}
},
{
"slug": "x-large",
"name": "Extra Large",
"size": "3.5rem",
"fluid": {
"min": "2.25rem",
"max": "3.5rem"
}
}
]
}
},
"styles": {
"color": {
"background": "var(--wp--preset--color--base)",
"text": "var(--wp--preset--color--contrast)"
},
"typography": {
"fontSize": "var(--wp--preset--font-size--medium)",
"lineHeight": "1.6"
},
"elements": {
"link": {
"color": {
"text": "var(--wp--preset--color--accent)"
}
},
"heading": {
"typography": {
"lineHeight": "1.2"
}
}
}
}
} version: 3is the theme.json format WordPress 6.6 introduced. The$schemaline lets code editors such as VS Code autocomplete keys and flag typos.layoutsets the default column width and the "Wide width" size. WordPress turned them into--wp--style--global--content-size: 640pxand--wp--style--global--wide-size: 1200px, with or without a styles block.color.paletteoffers three colours in the editor's colour pickers and as variables such as--wp--preset--color--accent.defaultPalette: falsetells the editor not to offer WordPress's own twelve colours.defaultFontSizes: falseis what makes the four font sizes count. WordPress's own sizes use the same slugs (small, medium, large, x-large), and in a version 3 file WordPress drops theme sizes with those slugs while defaultFontSizes is true. The earlier version of this generator did not write that line. When we loaded its output, all four of its font sizes were dropped and the variables showed core's 13px to 42px sizes instead, made fluid: medium came out asclamp(14px, 0.875rem + ((1vw - 3.2px) * 0.682), 20px), core's 20px. The current output kept all four.- Each fluid size has a
minand amax, and WordPress writes the clamp() itself. Medium came out asclamp(1rem, 1rem + ((1vw - 0.2rem) * 0.227), 1.125rem): 1rem on a 320px screen, growing to 1.125rem at the 1200px wide width. Small has no range, and at 0.875rem (14px) it is not above WordPress's default 14px minimum for fluid sizes, so it stays fixed. A size without a range that is bigger than 14px would still be made fluid, as core's 20px medium was above. stylesis the half that changes the page. It gives the body the Base background, Contrast text, the Medium font size and a 1.6 line height, colours links with Accent and sets headings to a 1.2 line height. Without it none of those rules appear. Our guide to theme.json settings, styles and the cascade covers this split in more depth.
When you need it
Use it when you are starting a block theme or child theme and want a working palette, font sizes and content widths without typing JSON by hand. theme.json also works with classic themes, where it can add a palette and font sizes to the block editor. The block theme vs classic theme comparison covers what that hybrid setup gives you.
How to use it
- Set your colours and layout widths above and pick the options you want.
- Copy the output into a file named theme.json in the root folder of your theme, next to style.css.
- Open the Site Editor (Appearance > Editor) and check that your colours and sizes show up under Styles.
The spacing option copies WordPress's own 7-step spacing scale into the file and sets defaultSpacingSizes: false. Unchanged it gives the same values as core (0.44rem to 5.06rem); change mediumStep or increment to make the scale your own. Without that false, WordPress would drop the theme's spacing sizes for the same reason as the font sizes.
Common mistakes
- A trailing comma or a missing quote. JSON does not allow them, and one stray character makes the whole file invalid.
- Reusing core's slugs without turning the defaults off. A font size called medium, or a spacing size 50, is ignored in a version 3 file unless defaultFontSizes or defaultSpacingSizes is false.
- Typing clamp() into a font size. WordPress passes it through unchanged, so the fluid settings no longer apply to that size; give min and max instead.
- Using version 3 on an older site. The output uses theme.json version 3, which needs WordPress 6.6 or later.
- Editing the file and seeing no change. Styles saved by a user in the Site Editor override theme data, so reset them there to see your file's values. A block template that is not applying can have the same cause: a copy saved in the database wins over the theme file.
Sources
- Block Editor Handbook: Theme.json Version 3 Reference
- Theme Handbook: Typography (fluid font sizes)
- Theme Handbook: Layout (content and wide sizes)
- WordPress Code Reference: wp_get_global_settings()
Limits
- It covers layout, a three-colour palette, four font sizes, spacing and a few global styles. Fonts, block-level styles, templates and template parts are not generated.
- We checked the output on WordPress 7.1.4 with a test block theme. We did not test the Site Editor's own screens, classic themes, child themes or older WordPress versions.
Guides for this tool
- WordPress Block Template Not Applying? Check the Database
Get WordPress serving your theme file again when a block template is not applying: clear the Site Editor copy in the database, then check filenames.
- WordPress Block Theme vs Classic Theme: Honest Comparison
Tell a block theme from a classic in 30 seconds, see what each costs editors and developers, and decide whether to switch, stay, or add theme.json instead.
- WordPress theme.json Explained: Settings, Styles, Cascade
Understand why settings and styles do different jobs in theme.json, and fix block theme edits that render nothing by working through the WordPress cascade.
- WordPress Child Theme Not Working? Fix CSS Not Loading
Child theme CSS not loading? WordPress itself never loads a child style.css. Enqueue it with the parent's real handle, and spot the parents that need none.
Reference
- WordPress Block Theme Template Hierarchy
Which template file wins, in a block theme
FAQ
Questions
Where does theme.json go?
In the root folder of your theme, next to style.css, with the exact name theme.json. A child theme can have its own theme.json, and WordPress merges it over the parent's.
Why does the file set defaultFontSizes to false?
Because WordPress's own font sizes use the same slugs: small, medium, large and x-large. In a version 3 theme.json, WordPress drops theme sizes with those slugs while defaultFontSizes is true, which is the default. We checked this on WordPress 7.1.4 and PHP 8.3.36 in WordPress Playground on 2026-11-16 by loading test block themes. A file from the earlier version of this generator, which did not have the line, lost all four of its font sizes, and WordPress used core's 13px to 42px sizes instead, made fluid. The current file kept all four. defaultSpacingSizes works the same way for spacing.
Do I need to write clamp() myself for fluid font sizes?
No. Set typography.fluid to true and give each size a min and max, and WordPress writes the clamp() for you, growing from a 320px screen to your wideSize. A clamp() you type into size yourself is passed through unchanged, so the fluid settings no longer affect that size.