// build responsive @media queries visually
Set breakpoints visually on a responsive ruler, choose min-width or max-width, pick px or em units, and export clean @media query CSS for any device preset or custom width.
Load a full framework preset (Tailwind, Bootstrap) or click individual device buttons to start. Add custom breakpoints with the + button and drag handles on the ruler.
Set the pixel value, choose min-width or max-width query type, and type CSS rules directly inside each breakpoint card's content box.
The generated CSS output updates instantly. Copy to clipboard or download a ready-to-use .css file.
CSS Media Query Generator lets you create responsive @media queries visually. Drag breakpoint handles on a pixel ruler, choose query type and unit, add CSS content per block, and export the complete stylesheet โ all in the browser, free, no sign-up required.
min-width queries apply when the viewport is at least the specified width โ this is the mobile-first approach, where you write base styles for small screens and progressively add styles for larger ones. max-width queries apply when the viewport is no wider than the value โ the desktop-first approach, starting wide and narrowing down. Most modern projects prefer mobile-first.
A range query targets a specific window of widths using both a minimum and a maximum: @media (min-width: 768px) and (max-width: 1023px). This is useful for styles that should only apply at tablet widths, for example, without affecting either mobile or desktop layouts. Range queries are more precise but require careful management to avoid gaps or overlaps between breakpoints.
Both work, but many accessibility experts recommend em units for media queries. When a user increases their browser's default font size, em-based breakpoints scale accordingly, ensuring the layout responds to the user's actual readable text size rather than just the physical viewport width. At the default 16px font size, 1em = 16px, so 768px รท 16 = 48em.
Tailwind's default breakpoints are sm: 640px, md: 768px, lg: 1024px, xl: 1280px, and 2xl: 1536px โ all using min-width queries. The mobile-first Tailwind preset loads all five of these into the tool at once, ready for customisation.
Bootstrap 5 uses six breakpoints: sm: 576px, md: 768px, lg: 992px, xl: 1200px, and xxl: 1400px โ all min-width. The xs breakpoint (below 576px) has no lower bound and is the default (no query). The Bootstrap preset loads all five named breakpoints.
@media (prefers-reduced-motion: reduce) targets users who have enabled the "Reduce Motion" accessibility setting on their device. Inside this block you should disable or reduce CSS animations and transitions. This is an important accessibility consideration โ some users experience motion sickness or disorientation from animated UI elements.
Responsive web design depends on @media queries to adapt layouts across screen sizes. Choosing the right breakpoints, selecting the correct query type, and writing the queries correctly every time requires knowing the syntax and the device landscape well. This visual generator removes the guesswork by letting you set breakpoints by dragging handles on a pixel ruler and configuring each query with a form โ no manual syntax required.
The industry standard for new projects is mobile-first: write base styles with no media query, then progressively enhance for larger screens using min-width queries. This approach produces leaner CSS, aligns with how CSS specificity naturally works (later rules win), and is consistent with how frameworks like Tailwind and Bootstrap handle responsiveness. Desktop-first, using max-width queries, is the traditional approach and is still appropriate for projects that started large and need to adapt down to mobile.
The most common mistake with breakpoints is choosing them based on specific device widths (iPhone, iPad, MacBook). Devices change, new screen sizes appear, and tying breakpoints to specific devices creates maintenance problems. The better approach is to add a breakpoint wherever the content actually breaks โ open the design in a browser, gradually resize the window, and add a breakpoint wherever the layout stops looking good. This produces breakpoints that are specific to your content rather than to the device landscape.
When using a CSS framework alongside vanilla CSS, matching your custom queries to the framework's breakpoints avoids conflicts. The Tailwind preset (sm 640, md 768, lg 1024, xl 1280, 2xl 1536) and Bootstrap preset (sm 576, md 768, lg 992, xl 1200, xxl 1400) are both available with one click. Foundation uses em-based breakpoints (small: up to 39.9375em, medium: 40em+, large: 64em+). Material UI uses a five-tier system (xs, sm, md, lg, xl) in pixels.
CSS Media Queries Level 4 introduced a more readable range syntax: @media (768px <= width <= 1023px) instead of the traditional @media (min-width: 768px) and (max-width: 1023px). Browser support is now excellent. This tool generates the traditional syntax for maximum compatibility, but understanding the range syntax is valuable when reading modern CSS or working with PostCSS plugins that use it.