Home Developer Tools Media Query Generator
📱
Developer Tool

Media Query Generator

Generate CSS media queries for any breakpoint or device. Choose standard breakpoints or enter a custom width — copy the query block in one click.

⚡ Live preview 📋 Copy CSS in one click 🚫 No login required ✅ Free forever

📖How to Use the Media Query Generator

  1. 1
    Choose a breakpoint

    Select a standard device breakpoint (mobile, tablet, desktop) or enter a custom min/max width in pixels.

  2. 2
    Select media type and feature

    Choose screen, print or all as the media type. Add additional features like orientation if needed.

  3. 3
    Copy the query

    Click Copy to copy the complete @media query block with a placeholder CSS rule inside.

CSS Tools in This Suite

ToolBest For
Bootstrap GridResponsive layouts
Border RadiusRounded corners
Box ShadowDepth & elevation
CSS VariablesDesign tokens
Flexbox1D layouts
Media QueryResponsive CSS

Frequently Asked Questions

What is a CSS media query?

A CSS media query applies styles conditionally based on characteristics of the device or browser window — most commonly the viewport width. It is the foundation of responsive web design.

What is the difference between min-width and max-width in media queries?

min-width applies styles when the viewport is wider than the given value (mobile-first approach). max-width applies styles when the viewport is narrower (desktop-first approach). Mobile-first is the recommended modern practice.

What are common breakpoints for responsive design?

Common breakpoints include 576px (small mobile), 768px (tablet portrait), 992px (tablet landscape/small desktop), 1200px (desktop) and 1400px (large desktop). These align with popular frameworks like Bootstrap and Tailwind.

What does @media screen mean?

screen targets devices with screens (monitors, phones, tablets). Other media types include print (for printers), speech (for screen readers) and all (matches all devices). screen is the most commonly used type for styling.

Can I combine multiple conditions in one media query?

Yes. Use and to combine conditions (e.g. @media screen and (min-width: 768px) and (max-width: 1200px)) and , (comma) to apply the same styles to multiple distinct queries.

What is the orientation media feature?

orientation: landscape applies when the device width is greater than its height. orientation: portrait applies when height is greater than width. Useful for adjusting layouts on mobile devices when rotated.

What is a mobile-first approach in CSS?

Mobile-first means writing base styles for small screens and using min-width media queries to progressively add styles for larger screens. It results in leaner CSS for mobile devices and is considered best practice.

Can media queries target device pixel ratio (retina displays)?

Yes. Use @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) to target high-resolution (HiDPI/Retina) displays. This is commonly used to serve higher-resolution images to retina screens.

What is the prefers-color-scheme media feature?

prefers-color-scheme: dark detects whether the user has requested a dark colour scheme in their OS settings. It is used to implement automatic dark mode in CSS without JavaScript.

Can I use CSS variables inside media query blocks?

Yes. You can redefine CSS custom property values inside a media query block, which will update any styles that use those variables. This is an efficient way to create responsive design tokens.