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

@media screen {
  /* your styles here */
}

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

  1. Select a media type (all, screen, print) from the dropdown.
  2. Enter optional min-width and max-width values with your preferred unit (px, em, rem).
  3. Choose an orientation constraint (landscape or portrait) if needed.
  4. Add extra conditions such as prefers-color-scheme or prefers-reduced-motion.
  5. The generated @media rule updates live as you change any option.
  6. 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