Fast • private • developer-friendly

Media Query Generator

Pick a breakpoint for mobile, tablet or desktop, choose min-width, max-width or orientation, and copy a ready-to-paste CSS @media block.

Live previewMatches ≥ 480px
Sample element
Editable CSS rule body
Ready-to-use @media block

🔒 Everything is generated locally in your browser and never uploaded.

How to build a CSS media query

Choose a device preset or enter a custom pixel width, then pick min-width, max-width or a combined range. Add an orientation condition when you need to target landscape or portrait layouts specifically. Edit the CSS rule body on the right so the generated block matches your real component, then copy the finished @media query straight into your stylesheet.

Mobile-first ready

Default to min-width breakpoints so base styles apply everywhere and enhancements layer on for larger screens.

Combine conditions

Chain a width range with orientation using the CSS and keyword, generated automatically for you.

Live device preview

See your sample element resize inside a simulated viewport as you adjust the breakpoint.

Media query generator FAQ

What is a CSS media query?

A media query is a CSS conditional block, written with @media, that applies styles only when the browser viewport matches given conditions such as a minimum or maximum width.

Should I use min-width or max-width breakpoints?

Most modern responsive design uses a mobile-first approach with min-width breakpoints, adding styles as the viewport grows. Max-width is useful when you are overriding desktop-first styles for smaller screens.

What breakpoints are common for mobile, tablet and desktop?

Common defaults are around 480px for large phones, 768px for tablets, 1024px for small laptops and 1280px for desktops, though exact values should match your actual design.

Can I combine width and orientation in one query?

Yes. This generator can combine a width condition with landscape or portrait orientation using the CSS 'and' keyword.

Does this tool store or upload my CSS?

No. Everything is generated locally in your browser and nothing is uploaded or saved on a server.