Media Query Builder & Analyzer
Generate or analyze CSS @media query conditions. Builds min-width, max-width, or width-range breakpoints with optional feature conditions, and validates pasted queries for balanced parentheses, known features, and meaningful structure.
🔒 100% Client-Side & Private — processed locally in your browser. Files never leave your device.
Options
Your result will appear here
Type or paste your input above, adjust the options, then press Run. Tip: press Ctrl+Enter to run, and ? for every shortcut.
How it works
Building a query from breakpoints
Build mode assembles @media clauses from an optional min-width, an optional max-width, and extra feature conditions, joined together with and. A feature must be a single parenthesized expression such as (hover: hover), and at least one width or feature condition is required before anything is emitted.
Reading a pasted query
Analyze mode lists every feature condition with its validity, checks that parentheses balance and stay within a sensible depth, and flags queries that carry no feature at all or that omit a comparison operator and value.
Known feature names
Width, height, aspect-ratio, orientation, resolution, pointer and hover are recognised, along with prefers-color-scheme, prefers-reduced-motion and friends. An unrecognised feature is marked for review rather than assumed valid.
Mobile-first habit
min-width favours small screens first, letting breakpoints add on as the viewport grows, while max-width suits a desktop-first cascade. Either is fine, but pick one order and keep the project consistent.
Parsed in the browser
Queries are analysed and composed entirely on-device. Nothing is sent anywhere and the tool works offline.
Questions
What makes a media query?
A media type (optional, default all) plus one or more feature conditions combined by and, or, or not.
Should I use min-width or max-width first?
Mobile-first CSS favors min-width so base styles apply to small screens and breakpoints add on. Desktop-first favors max-width.
Why balance parentheses?
Media queries nest feature expressions in parentheses; unbalanced parens make the whole rule invalid and the declaration block is dropped.
Related tools
See categoryCSS Grid Generator
Generate CSS Grid layout declarations for tracks, gaps, alignment, and named areas.
Fluid CSS Clamp Generator
Generate responsive CSS clamp() values between viewport breakpoints.
CSS Unit Converter
Convert between px, rem, em, pt, pc, in, cm, mm and % for CSS lengths.
:nth-child An+B Evaluator
Parse CSS An+B (:nth-child, :nth-of-type) microsyntax, validate it, and list which child indices it matches.