About this tool
Media Query Builder writes the opening of a responsive @media rule. Pick min-width, max-width or a range, enter pixel values, optionally restrict to portrait or landscape orientation, and copy the result. Three preset buttons fill in common breakpoints: Mobile sets max-width 767px, Tablet sets a range of 768px to 1023px, and Desktop sets min-width 1024px.
The output is a complete rule skeleton such as @media (min-width: 768px) and (max-width: 1023px) { /* ... */ } with an empty comment where your styles go. Conditions are joined with and. Widths are whole pixel numbers: decimals are cut to integers and blank or negative entries become 0. The tool does not warn if the minimum is larger than the maximum, which would never match any screen.
A min-width query is the usual mobile-first approach, applying styles from a width upward, while max-width applies up to a width. Using 767 and 768 rather than the same number for neighbouring ranges avoids a one-pixel overlap. Only width and orientation are supported, not height, resolution or prefers-color-scheme. The preset values are conventions, not standards. Everything is generated in your browser.