Chrome DevTools is a powerful debugging tool, but most developers only scratch the surface. Here are 10 tricks that have saved me countless hours and made debugging much more efficient.
1. Console Shortcuts
Use $0 to reference the last selected element in Elements panel. $1 through
$4 reference the previous selections. This is incredibly useful for quick DOM manipulation.
// Select an element, then in console:
$0.style.backgroundColor = 'red';
$0.textContent = 'Changed!';
2. Break on DOM Changes
Right-click any element → Break on → Attribute modifications. DevTools will pause when that element or its attributes change. Perfect for debugging dynamic content.
3. Copy as cURL
In Network tab, right-click any request → Copy → Copy as cURL. This gives you the exact command to reproduce the request from terminal. Great for API testing.
4. Local Overrides
Override files without changing source code:
- Open Sources tab → Overrides
- Select a folder for overrides
- Edit files directly in DevTools
- Changes persist across page reloads
5. Command Menu (Cmd/Ctrl + Shift + P)
Access all DevTools features quickly:
- "Show Coverage" - See unused CSS/JS
- "Capture node screenshot" - Screenshot specific elements
- "Show rendering" - Enable paint flashing
6. Network Throttling
Test your app on slow connections. In Network tab, use throttling dropdown to simulate 3G, 4G, or custom speeds. Essential for mobile testing.
7. Console.table()
Display arrays/objects in a nice table format:
const users = [
{ name: 'John', age: 30 },
{ name: 'Jane', age: 25 }
];
console.table(users);
8. Monitor Events
In Console, use monitorEvents(element) to log all events on an element:
monitorEvents(document.querySelector('button'));
// Logs all click, mouseover, etc. events
9. Performance Recording
Record performance to identify bottlenecks:
- Open Performance tab
- Click Record
- Interact with your app
- Stop and analyze the timeline
10. Snippets
Save and run reusable code snippets:
- Sources tab → Snippets
- Create new snippet
- Write your code
- Right-click → Run
Bonus: Quick Element Selection
Press Cmd/Ctrl + Shift + C to toggle element selection mode. Much faster than
right-clicking and inspecting.
"Mastering DevTools is like having a superpower. These tricks turn hours of debugging into minutes."
Conclusion
These DevTools tricks have become essential parts of my workflow. Start with a few that seem most useful for your work, and gradually incorporate more. The time saved will compound quickly.