CSS & Layout

Media Query Generator

Pick a breakpoint and any device conditions, then copy a ready-to-use @media block. The live match preview shows whether the query applies to a simulated device. Everything runs in your browser — nothing is sent to a server.

Runs in your browser v1.0.0

Build your query

live
Quick breakpoints
Width condition
768px
Device & preference conditions
Advanced conditions Contrast and display mode

Generated media query

copy & paste


                    

Live match preview

—
1024 × 768
1024px
768px
Simulated device preferences Defaults to your device

    How it works

    Each non-empty condition is combined with and to form a complete @media block. The live match preview compares the query against a simulated viewport: width and height drive orientation, and the preference conditions are matched against the simulated device settings (which start from your real device). Widths in rem or em are converted at 16px per unit for comparison. Invalid input is reported inline instead of producing broken CSS.