Code · Made a little simpler

Media Query Builder

Build CSS media queries for widths, heights, orientation, print and custom conditions. Test matches in a resizable viewport and export the stylesheet.

Free to useNo account neededProcessed on your device
Your workspaceProcessed on your device
Media query rules
Viewport match preview

The preview evaluates query conditions with the browser. Your declarations remain export text.

Generated output

Add this tool to your website

Paste this code into your page to add the tool and a visible ToolMellow credit link.

HTML embed code
Preview embed

Media Query Builder: how to use it

  1. Load Two breakpoints, then set Preview width to 599, 600 and 900 pixels. Check which rules match at each boundary.
  2. Choose screen, print or all, set the condition and units, and edit the target class and its declarations. Arrange the rules in cascade order.
  3. Copy or download the selected rule or complete stylesheet.

Limits and notes

Up to 12 queries, using px, em or rem for typed dimensions. The preview uses the browser's real viewport matching and keeps entered declarations inert. Browser-dependent features match the running browser's environment. Input stays on your device.

How your privacy works →

Media Query Builder: common questions

Does min-width include the exact breakpoint?

Yes. A min-width rule at 600px matches at 600px and larger. A max-width rule includes its upper endpoint.

Why do two rules match at 900px?

Minimum-width rules overlap by design. If two rules set the same property with the same specificity and importance, their stylesheet order determines the result.

What changes an em or rem breakpoint?

Media query relative units use the browser's initial font size, which can reflect user preferences. Setting a font size in the target stylesheet does not change that initial value.

Guides