Skip to content

Menu

Media Query Generator

Generate responsive CSS media queries

Runs entirely in your browserFrontendFree, no sign-up
Loading tool

01What is Media Query Generator?

Breakpoints are easy to agree on in a meeting and easy to drift apart in code. One file says 768, another says 767, and the Sass mixins don't match the Tailwind config. This generator keeps one list of named breakpoints and writes it out three ways, so every format comes from the same numbers. Each breakpoint has a name, an optional min width and an optional max width, in pixels. The CSS format writes one @media block per breakpoint, using min-width and max-width from the Media Queries spec and joining them with "and" when both are set. A breakpoint with neither value becomes a comment marking base styles, because those don't need a query at all. SCSS Mixins wraps the same query around @content in a @mixin, so you can write @include tablet { ... } anywhere. Mixin names are lowercased, and anything that isn't a letter, digit, dash or underscore turns into a dash. A name that would start with a digit, like 2xl, gets a bp- prefix, since a Sass identifier can't begin with a number. Tailwind Config only uses breakpoints with a min width, because Tailwind screens are min-width and mobile-first. You get a theme.screens block for a v3 tailwind.config.js and a v4 @theme block with --breakpoint-* variables. The v4 values are px divided by 16 and written in rem, which matches the unit Tailwind v4's own defaults use. If nothing has a min width, you get a short note pointing you to max-* variants instead of an empty config that would wipe out the defaults. Three presets start you off. Mobile First has a base plus 768, 1024 and 1280. Desktop First uses max widths of 1279, 1023 and 767. Tailwind loads sm at 640 through 2xl at 1536. A ruler under the output plots each min width on a 0 to 1920px scale. A quick example: one breakpoint named "Tablet only" with min 768 and max 1023 gives @media (min-width: 768px) and (max-width: 1023px) in CSS and a mixin called tablet-only in SCSS. Some limits worth knowing. Everything is in pixels, and the inputs only keep positive whole numbers, so 0 or a decimal clears the field. The v3 block replaces Tailwind's default screens rather than extending them. The tool doesn't check for overlapping or out-of-order ranges, so sorting them is up to you. Your breakpoint list lives in the page's memory only, and the reset button brings back the Mobile First preset.

Frontend developers and design system maintainers who need the same breakpoint list as plain CSS, Sass mixins and Tailwind v3 or v4 config. The tool runs entirely in your browser, so your data never leaves your device.

02How to use Media Query Generator

  1. Pick a Preset: Mobile First, Desktop First or Tailwind.
  2. Edit each breakpoint's Name, min and max fields. Click Add for a new row, or the trash icon to remove one.
  3. Choose a Format: CSS, SCSS Mixins or Tailwind Config.
  4. Check the output panel and the ruler underneath it.
  5. Click Copy to take the output.

03Worked examples

Input: Preset Mobile First, Format CSS
Result: /* Mobile - base styles (no media query) */ /* Tablet */ @media (min-width: 768px) { /* styles */ } …
A breakpoint with no min or max becomes a base styles comment. Output shortened after the first query.
Input: Preset Desktop First, Format CSS
Result: /* Wide - base styles (no media query) */ /* Desktop */ @media (max-width: 1279px) { /* styles */ } …
Desktop-first uses max-width, one pixel under the next breakpoint up. Shortened.
Input: One breakpoint "Tablet only", min 768, max 1023, Format SCSS Mixins
Result: @mixin tablet-only { @media (min-width: 768px) and (max-width: 1023px) { @content; } }
Both limits are joined with "and". The space in the name becomes a dash.
Input: Preset Mobile First, Format Tailwind Config (v4 part)
Result: @theme { --breakpoint-tablet: 48rem; /* 768px */ --breakpoint-desktop: 64rem; /* 1024px */ --breakpoint-wide: 80rem; /* 1280px */ }
The full output also starts with a note that 1 breakpoint without a min width was left out, then the v3 block.
Input: Preset Desktop First, Format Tailwind Config
Result: // Tailwind breakpoints are min-width only, and none of these breakpoints has a min width. // Add a min value, or use max-* variants (e.g. max-md:) for desktop-first styles.
Max-width-only breakpoints can't become Tailwind screens, so you get an explanation instead of config.
Input: Breakpoint named "2xl" with min 1536, Format SCSS Mixins
Result: @mixin bp-2xl { @media (min-width: 1536px) { @content; } }
A Sass identifier can't start with a digit, so the tool adds a bp- prefix.

04Common use cases

  • Writing a shared _breakpoints.scss partial with one mixin per breakpoint at the start of a Sass project
  • Copying a design system's breakpoints from Figma into Tailwind v3 screens or a v4 @theme block
  • Rewriting a legacy desktop-first stylesheet's breakpoints as explicit max-width queries
  • Adding a tablet-only range query with both min-width and max-width for one awkward component
  • Converting pixel breakpoints to the rem values Tailwind v4 expects without doing the division by hand
  • Documenting the agreed breakpoints, with a visual ruler, for a team style guide

05Tips

  • Desktop-first max widths sit one pixel under the next breakpoint (767, 1023, 1279). That way a 768px screen matches exactly one query, not two.
  • Name breakpoints in plain words. "Tablet only" becomes the mixin tablet-only and the v4 variable --breakpoint-tablet-only, which reads well in code.
  • The v3 Tailwind block replaces the default screens. If you only want to add one, move it under theme.extend.screens after you paste.
  • Pick breakpoints where your layout actually breaks, not where a particular phone happens to sit.
  • For a card that sits in containers of different widths, a container query (@container) often fits better than a viewport media query.

06Related concepts

Responsive design, Breakpoints, Mobile-first, Sass mixins, Tailwind screens.

Frequently Asked Questions

What is Media Query Generator?

Media Query Generator is a free, browser-based developer tool on AIDToolStack. Generate responsive CSS media queries It requires no installation or sign-up and works entirely in your browser.

Is Media Query Generator free to use?

Yes. No sign-up, no fees and no usage cap.

Does Media Query Generator store my data?

No. It runs in your browser; nothing is uploaded.

Reviews and commentsShow

Reviews

Sign in to leave a review.

Loading reviews…

Comments

Sign in to leave a comment.

Loading comments…

What changed in AI dev tools, once a month

Renames, shutdowns, pricing changes and new MCP setups, each with a source.

Subscribe