CSS Media Query Builder
Set min-width, max-width, orientation, and other conditions to instantly generate a valid CSS @media query rule.
Query Options
Generated Rule
Valid
No conditions set
@media screen {
/* your styles here */
}
Copied to clipboard.
Breakpoint Ruler
0
480px
768px
1024px
1280px
1920px
The highlighted region shows the viewport widths matched by your query.
Condition Breakdown
- No conditions active yet.
Copied!
Summary
Set min-width, max-width, orientation, and other conditions to instantly generate a valid CSS @media query rule.
How it works
- Select a media type (all, screen, print) from the dropdown.
- Enter optional min-width and max-width values with your preferred unit (px, em, rem).
- Choose an orientation constraint (landscape or portrait) if needed.
- Add extra conditions such as prefers-color-scheme or prefers-reduced-motion.
- The generated @media rule updates live as you change any option.
- Click Copy to paste the rule straight into your CSS file.
Use cases
- Generate breakpoint rules for custom responsive layouts without memorizing syntax.
- Quickly prototype media queries for mobile-first or desktop-first stylesheets.
- Verify the exact syntax required for print stylesheets.
- Build orientation-specific rules for tablet and phone layouts.
- Use Tailwind, Bootstrap, or Material UI presets as a starting point.
- Teach or learn CSS media query syntax interactively.
- Create reduced-motion or dark-mode conditional rules.
- Test combined conditions (range + orientation + media feature) with correct logic operators.
Frequently Asked Questions
Last updated: 2026-06-09 ·
Reviewed by Nham Vu