Auto Expand Objects in Chrome DevTools – How to Enable
In this article
- Background: Why Objects Stay Collapsed
- How the Auto‑Expand Mechanism Works
- Enabling Auto‑Expand via Settings
- Using the “Expand Recursively” Command
- Keyboard Shortcuts for Faster Navigation
- Common Problems and How to Fix Them
- Extensions and Third‑Party Alternatives
- Safety and Performance Considerations
- Frequently Asked Questions
Yes, Chrome DevTools can auto‑expand objects—just set the “Auto‑expand depth” preference or use the “Expand recursively” command, both of which are built‑in and require no extra extensions.
Background: Why Objects Stay Collapsed
When you inspect a variable in the Console or watch an object in the Sources panel, DevTools shows a compact representation (e.g., {…}) to keep the UI readable. Large objects with many nested properties can become cumbersome if you have to click each arrow manually. The feature to auto‑expand objects was added to address this workflow friction, especially for developers debugging complex JSON payloads, Redux state trees, or DOM element hierarchies.
How the Auto‑Expand Mechanism Works
Chrome stores a numeric “depth” value that tells the UI how many levels of an object tree should be opened automatically when the object is first rendered. The default depth is 1, meaning only the top‑level keys are shown. When the depth is increased, DevTools walks the object recursively and expands each property until the specified level is reached. The operation is performed client‑side; no network request is involved, so it does not affect page performance.
Enabling Auto‑Expand via Settings
- Open DevTools (press F12 or Ctrl+Shift+I on Windows/Linux, ⌥⌘I on macOS).
- Click the gear icon (⚙️) in the upper‑right corner to open the Settings panel.
- In the left sidebar choose Preferences. (Menu labels may vary slightly between Chrome versions, but the gear icon is consistent.)
- Scroll down to the Console section.
- Find the field labeled Auto‑expand depth. Enter a numeric value—common choices are 2 for shallow inspection, 3‑4 for most JSON payloads, or 0 to keep everything collapsed.
- Close the Settings panel. The next time you log an object, DevTools will expand it to the depth you specified.
If you want a temporary expansion without changing the global setting, you can use the context menu on a specific object.
Using the “Expand Recursively” Command
Right‑clicking an object in the Console opens a context menu that includes Expand recursively. Selecting this option expands the object to the maximum depth that fits on screen, overriding the global setting for that instance only. This is handy when you encounter a single large object and do not want to adjust the permanent preference.
Keyboard Shortcuts for Faster Navigation
DevTools provides a shortcut to toggle the recursive expansion of the currently selected console entry:
- Ctrl+Shift+] (Windows/Linux) or ⌘+Shift+] (macOS) expands the selected object one level deeper.
- Ctrl+Shift+[ (Windows/Linux) or ⌘+Shift+[ (macOS) collapses one level.
These shortcuts work in the Console panel when the cursor is on a logged object. They respect the global auto‑expand depth, so they are useful for fine‑tuning the view without leaving the keyboard.
Common Problems and How to Fix Them
Even with the setting enabled, some developers notice that objects still appear collapsed. The most frequent causes are:
- Out‑of‑date Chrome version. The auto‑expand depth preference was introduced in a recent release; older builds simply lack the option. Updating Chrome resolves the issue.
- Custom formatters interfering. If a library registers a custom console formatter (e.g.,
util.inspect.customin Node‑compatible code), DevTools may defer to that formatter, which can suppress auto‑expansion. Disable the formatter or useconsole.dirinstead ofconsole.logto bypass it. - Large circular references. Objects that contain circular references are automatically truncated to avoid infinite loops, regardless of depth settings. DevTools shows a warning like
[Circular]and only expands non‑circular parts.
To troubleshoot, start by resetting the preference to the default (1), close and reopen DevTools, then re‑apply your desired depth. If the problem persists, try logging the object with console.dir which forces a plain‑object view.
Extensions and Third‑Party Alternatives
While the built‑in setting covers most use cases, a few extensions add extra convenience:
- JSON Viewer – formats JSON strings in the Console and adds a “Pretty‑print” button that automatically expands the full tree.
- Redux DevTools – when debugging state objects, this extension provides a dedicated UI with configurable depth and search capabilities.
- React Developer Tools – expands React component props and state objects automatically based on the same depth preference, but also offers a “Show all properties” toggle.
All of these extensions are available from the Chrome Web Store and respect the same security model as the browser; they do not modify the underlying auto‑expand algorithm.
Safety and Performance Considerations
Auto‑expanding very deep or very large objects can degrade DevTools responsiveness, especially on low‑end machines. Each additional level requires the UI to create more DOM nodes, which may cause noticeable lag when scrolling or searching. To mitigate this:
- Use the smallest depth that still shows the information you need.
- Limit auto‑expansion to debugging sessions; revert to the default depth for routine development.
- Avoid logging entire DOM trees; instead, log specific properties (e.g.,
element.idorelement.dataset) to keep the payload small.
These practices keep the console fast and prevent accidental exposure of sensitive data that might be present in deep object graphs.
Frequently Asked Questions
Can I set a different auto‑expand depth for each DevTools panel?
No. The “Auto‑expand depth” preference is global for the Console panel only. Other panels such as Sources or Elements use their own expansion logic and do not share this setting.
Does the auto‑expand setting persist across browser restarts?
Yes. The value is stored in Chrome’s user profile, so it remains active until you change it or reset Chrome’s settings.
Is there a way to auto‑expand only objects that match a certain pattern?
Not with the built‑in feature. You would need to write a custom script that walks the object and logs only the matching branches, or use an extension that provides filtered expansion.
Why does an object still show {…} even after I increased the depth?
Most likely the object contains a circular reference or a custom formatter that overrides the default display. Use console.dir or remove the formatter to see the full structure.
Can I disable auto‑expand for a single log entry?
Yes. Right‑click the entry and choose Collapse recursively. This overrides the global depth for that specific line.
Do mobile versions of Chrome DevTools support auto‑expand?
The mobile remote‑debugging interface mirrors the desktop UI, including the auto‑expand depth setting, but the Settings panel is accessed through the three‑dot menu in the remote view rather than a gear icon.