Chrome DevTools Responsive Mode: How to Use
In this article
To use Chrome DevTools responsive mode, open DevTools (F12 or Ctrl+Shift+I on Windows/Linux, Cmd+Option+I on Mac), then click the device toolbar icon (the rectangle with a phone and tablet) or press Ctrl+Shift+M (Cmd+Shift+M on Mac). This switches the page to a responsive viewport that you can resize by dragging the edges or typing exact pixel dimensions.
What Is Responsive Mode and Why It Matters
Responsive mode is a built-in feature in Chrome DevTools that lets you simulate how a webpage looks and behaves on different screen sizes without leaving your desktop browser. It is essential for front-end developers and designers because it lets you test CSS media queries, flexible layouts, and touch interactions before deploying to real devices. Instead of manually resizing your browser window or buying multiple devices, you can instantly switch between phone, tablet, and desktop dimensions.
The tool is not just for visual checking—it also affects how the browser renders the page, so JavaScript that responds to viewport changes, like lazy-loading images or dynamic navigation menus, will behave as it would on a real device. This makes it a reliable first step in responsive design testing, though it does not replace testing on actual hardware for final verification.
How to Open and Control Responsive Mode
There are several ways to enter responsive mode, and once you are in it, you have fine-grained control over the viewport.
- Open DevTools by right-clicking any part of the page and selecting "Inspect," or use the keyboard shortcut F12 (Windows/Linux) or Cmd+Option+I (Mac).
- Toggle the device toolbar by clicking the icon that looks like a small rectangle with a phone and tablet overlapping, located in the top-left of DevTools. Alternatively, press Ctrl+Shift+M (Windows/Linux) or Cmd+Shift+M (Mac).
- Choose a device preset from the dropdown menu at the top of the toolbar. Options include common phones like iPhone 12, Pixel 5, and tablets like iPad. Selecting a preset automatically sets the correct width, height, and pixel ratio.
- Resize manually by dragging the right or bottom edge of the viewport area, or by typing exact pixel values in the width and height fields (the height field appears when you click the lock icon to unlink aspect ratio).
- Rotate the viewport by clicking the rotate icon (a curved arrow) to switch between portrait and landscape orientation.
You can also zoom the page within the viewport using the zoom dropdown (default 100%). This is different from the device pixel ratio, which simulates high-DPI screens.
Choosing the Right Device Preset vs. Custom Dimensions
Device presets are convenient because they match popular real-world devices, but they are not always the best choice. Presets set a specific width, height, and device pixel ratio (DPR), but they do not change the browser’s user agent string or other device characteristics unless you enable “Emulate device” in the settings. For most testing, custom dimensions are more flexible because you can test any breakpoint your design uses.
For example, if your CSS has a breakpoint at 768px, you can type 768 in the width field and see exactly how the layout shifts. This is more precise than choosing a preset that might be 375px wide. Also, presets often have a fixed height, which can hide content that only appears when the viewport is taller or shorter. To see the full page, you can drag the bottom edge to make the viewport as tall as you like, or use the “Fit” option in the zoom menu to shrink the entire page to fit the available space.
Key Features: Device Pixel Ratio, Media Queries, and Touch
Responsive mode includes several advanced options that go beyond simple resizing. The device pixel ratio (DPR) setting lets you simulate high-resolution screens like Retina displays. You can set DPR to 1, 2, or 3 to see how images and CSS render on different pixel densities. This is important for checking that images are not blurry or oversized.
Another powerful feature is the media query inspector. When you click the “Media queries” button (the icon with two overlapping rectangles) in the device toolbar, DevTools shows color-coded bars above the viewport representing your CSS media queries. You can click on a bar to jump to that breakpoint, making it easy to test each layout stage.
You can also simulate touch input by clicking the touch icon (a circle with a finger) in the toolbar. This makes the cursor behave like a finger, and it enables touch events in the browser. This is useful for testing hover states (which should not appear on touch devices) and touch-specific interactions like swiping.
Common Problems and How to Solve Them
One common issue is that responsive mode does not change the user agent string by default, so some websites serve desktop versions to mobile browsers. To fix this, click the three-dot menu in the device toolbar and select “Show device frame” or “Add device pixel ratio,” but for user agent emulation, you need to open the DevTools settings (F1) and under “Device emulation” check “Emulate device” or manually override the user agent in the Network conditions panel.
Another problem is that the viewport may not match the actual screen size of a physical device because of browser chrome (address bar, tabs) taking up space. To simulate the full screen, you can use the “Full size” option in the device toolbar, which makes the viewport as large as the available DevTools space. For a more accurate test, you can also use Chrome’s built-in “Device Mode” in the Rendering tab to emulate CSS media features like prefers-color-scheme.
If your page looks fine in responsive mode but broken on a real phone, the cause is often the device pixel ratio or the fact that real devices have different viewport meta tags. Make sure your page includes the <meta name="viewport" content="width=device-width, initial-scale=1"> tag in the HTML head.
Responsive Mode vs. Other Testing Methods
Responsive mode is not the only way to test responsive design. You can also use the browser’s built-in “Toggle device emulation” (which is the same as responsive mode), or you can use third-party tools like BrowserStack or LambdaTest, which provide real device cloud testing. Responsive mode is free, fast, and built into Chrome, making it the best starting point. However, it does not emulate the exact rendering engine of Safari or Firefox, so cross-browser testing on real devices is still necessary for production.
Another alternative is to use Chrome’s “Rendering” tab to emulate CSS media features like prefers-color-scheme or forced-colors, which can affect layout. This is separate from responsive mode but complements it.
Frequently Asked Questions
How do I exit responsive mode?
Click the device toolbar icon again, or press Ctrl+Shift+M (Cmd+Shift+M on Mac) to toggle it off. The viewport will return to the normal browser window size.
Can I test a specific screen size like 320px?
Yes, type 320 in the width field in the device toolbar. You can also add custom devices in DevTools settings (F1) under “Devices” to save a custom preset.
Does responsive mode change the user agent?
No, by default it does not. To change the user agent, open the DevTools settings, go to “Devices,” and check “Emulate device” or use the Network conditions panel to override the user agent string.
Why does my page look different on a real phone?
Real phones have different viewport sizes, device pixel ratios, and browser behaviors. Also, if your page lacks the viewport meta tag, mobile browsers may render it at a wider width and then zoom out. Always include the viewport meta tag and test on actual hardware for final checks.
Can I test touch events in responsive mode?
Yes, click the touch icon in the device toolbar to simulate touch input. This enables touch events and makes the cursor behave like a finger, but it does not simulate multi-touch gestures like pinch-zoom.
Is responsive mode the same as device emulation?
They are essentially the same in Chrome DevTools. The device toolbar provides responsive mode, and the “Devices” dropdown includes presets. Some people use “device emulation” to refer to the broader feature set, including user agent and sensor emulation, which you can access in the DevTools settings.