Chrome DevTools: The Complete Guide for Web Developers (Elements, Console, Network, Performance and More)
A complete, practical guide to browser developer tools: every major DevTools panel, real debugging workflows, network and performance analysis, and shortcuts you will use daily.
Every modern browser ships with a full debugging suite called Developer Tools (DevTools). It lets you inspect and change the page live, run JavaScript, pause code line by line, watch every network request and measure exactly why a page is slow. This guide walks through every important panel with real workflows. Examples use Chrome, but Edge is identical and Firefox and Safari have close equivalents.
How to open DevTools#
- F12, or Ctrl+Shift+I on Windows/Linux, Cmd+Option+I on Mac.
- Right-click any element and choose Inspect to open the Elements panel with it selected.
- Ctrl+Shift+J / Cmd+Option+J opens the Console directly.
- Ctrl+Shift+P / Cmd+Shift+P opens the Command Menu, a search box for every DevTools feature (try "screenshot", "dark", "disable JavaScript").
Elements: inspect and edit HTML and CSS live#
The Elements panel shows the live DOM (not your original HTML file, but what JavaScript has built). On the right, the Styles pane shows every CSS rule that applies to the selected element, in order of priority.
- Edit anything: double-click text, attributes or CSS values. Changes are instant and disappear on reload, so it is a safe playground.
- Crossed-out rules mean another rule overrode them. Hover to see why.
- Computed tab: the final value of every property and which file set it. Great for "why is this font 13px?"
- Box model diagram: margin, border, padding and content sizes.
- flex and grid badges next to elements toggle visual overlays of your layout.
- :hov button: force
:hover,:focusor:activestates so you can style them without holding the mouse. - Break on (right-click a node): pause JavaScript when the node's subtree, attributes or removal changes. Perfect for finding "what script keeps hiding this div?"
Press H on a selected element to hide it, and Ctrl+Z to undo DOM edits. Use the device toolbar (Ctrl+Shift+M) to test responsive layouts at phone and tablet sizes.
Console: run code and read errors#
The Console shows logs, warnings and errors, and it is a full JavaScript REPL running inside the page.
// The element selected in Elements is available as $0
$0.textContent
// jQuery-style helpers (built into DevTools)
$("button") // document.querySelector
$$("a") // document.querySelectorAll as an array
copy($$("a").map(a => a.href)) // copy all links to the clipboard
// Better logging
console.table([{ id: 1, name: "Asha" }, { id: 2, name: "Ravi" }]);
console.group("Checkout");
console.log("cart", cart);
console.groupEnd();
console.time("fetch");
await fetch("/api/products");
console.timeEnd("fetch"); // fetch: 182 ms
// Watch events on an element
monitorEvents(window, "resize");- Click the file name on the right of an error to jump to the exact line in Sources.
- Use the filter box and log levels to hide noise.
- Live expressions (the eye icon) re-evaluate an expression continuously, e.g.
document.activeElementto debug focus. - Preserve log keeps messages across page reloads and redirects.
Sources: real debugging with breakpoints#
console.log everywhere is slow and messy. Breakpoints pause the code so you can see every variable at that moment.
Types of breakpoints#
| Breakpoint | When to use it |
|---|---|
| Line breakpoint | Click a line number. Pauses every time that line runs. |
| Conditional breakpoint | Pause only when an expression is true, e.g. item.price < 0. Ideal inside loops. |
| Logpoint | Logs a message without pausing and without editing your code. |
debugger; statement | Put it in your code; execution pauses there when DevTools is open. |
| XHR/fetch breakpoint | Pause when a request URL contains some text, e.g. /api/cart. |
| Event listener breakpoint | Pause on any click, keydown, submit handler, even if you don't know where it is. |
| Pause on exceptions | Stop right where an error is thrown, including caught ones. |
When paused, use the Scope pane to read local and closure variables, Watch to track expressions, and Call Stack to see how you got there. Step with F10 (over), F11 (into), Shift+F11 (out) and resume with F8.
Source maps#
Production code is bundled and minified. If your build generates source maps, DevTools shows your original files (TypeScript, JSX) and breakpoints work on them. In webpack this is the devtool option; in Vite they are on in development by default.
Local overrides#
Overrides let you edit a CSS or JS file from a live site and keep the change across reloads. Useful for testing a fix on production before you deploy it.
Network: every request, explained#
The Network panel records each request the page makes: HTML, CSS, JS, images, fonts and API calls. Open it before loading the page, or reload with it open.
- Filter by type (Fetch/XHR, JS, CSS, Img) or text. Type
status-code:500orlarger-than:200kfor advanced filters. - Click a request to see Headers (method, status, cookies, CORS headers), Payload (what you sent), Preview/Response (what came back) and Timing.
- Disable cache to see what first-time visitors experience.
- Throttling: simulate "Slow 4G" or go offline to test loading states and error handling.
- Right-click a request → Copy as cURL or Copy as fetch to replay it in a terminal or the Console.
- Block request URL to see how your page behaves when a script or API fails.
A CORS error in the Console means the server did not send the right Access-Control-Allow-Origin header. Check the failing request's response headers in Network; the fix is on the backend, not in your fetch call.
Performance: find out why the page is slow#
Click record, interact with the page (or use the reload button to profile loading), then stop. You get a timeline of everything the browser did.
- Main thread flame chart: wide bars are slow functions. Tasks with a red corner are long tasks (over 50 ms) that block clicks and hurt INP.
- Bottom-Up tab: which functions used the most time in total.
- Layout shifts track: shows exactly which element moved (CLS).
- Timings track: FCP and LCP markers, with the LCP element highlighted.
- Enable CPU throttling (4x or 6x slowdown) to feel what users on cheaper phones feel.
The Performance panel's live metrics view shows LCP, CLS and INP as you interact with the page, so you can click a button and immediately see its interaction delay. For a deep dive into these metrics, see our Core Web Vitals guide.
Memory: hunt down leaks#
If your single-page app gets slower the longer it stays open, you probably have a memory leak.
- Open Memory and take a heap snapshot.
- Perform the action you suspect (open and close a modal 10 times).
- Take another snapshot and choose the Comparison view.
- Look for objects whose count keeps growing, and search for Detached to find DOM nodes removed from the page but still referenced in JavaScript.
Common causes: event listeners never removed, setInterval never cleared, and global arrays or caches that only grow.
useEffect(() => {
const onResize = () => setWidth(window.innerWidth);
window.addEventListener("resize", onResize);
const id = setInterval(poll, 5000);
return () => { // cleanup prevents the leak
window.removeEventListener("resize", onResize);
clearInterval(id);
};
}, []);Application: storage, cookies and service workers#
- View and edit localStorage, sessionStorage, IndexedDB and cookies (check
HttpOnly,SecureandSameSiteflags here). - Service workers: see the registered worker, force update, or bypass it during development.
- Cache storage: what your PWA has cached offline.
- Clear site data: one click to reset everything, the fastest way to reproduce a "first visit" bug.
Lighthouse: an automated audit#
Lighthouse runs a scripted page load and scores Performance, Accessibility, Best Practices and SEO, with a list of specific fixes. Run it in an Incognito window so extensions don't skew results, and remember it is lab data from one simulated device. Real-user data (from the Chrome UX Report or your own monitoring) tells you what users actually experience.
Real-world problems and how DevTools solves them#
| Problem | Where to look |
|---|---|
| Button does nothing when clicked | Console for errors; Elements → Event Listeners tab; event listener breakpoint on click |
| API returns wrong data | Network → request Payload and Response; Copy as cURL to test the backend directly |
| CSS not applying | Elements → Styles (crossed out = overridden), Computed tab for the winning value |
| Page loads slowly | Network waterfall (big files, long TTFB), Lighthouse report |
| Typing or scrolling feels laggy | Performance recording, look for long tasks and forced layouts |
| Content jumps while loading | Performance → Layout shifts track |
| App gets slower over time | Memory → heap snapshot comparison, Detached nodes |
| User is logged out randomly | Application → Cookies (expiry, SameSite), Network → Set-Cookie headers |
| Works locally, broken on mobile | Device toolbar, network throttling, or remote debugging a real Android phone via chrome://inspect |
Shortcuts worth memorising#
| Action | Windows / Linux | Mac |
|---|---|---|
| Open DevTools | F12 / Ctrl+Shift+I | Cmd+Option+I |
| Inspect element mode | Ctrl+Shift+C | Cmd+Shift+C |
| Command Menu | Ctrl+Shift+P | Cmd+Shift+P |
| Open file in Sources | Ctrl+P | Cmd+P |
| Search across all files | Ctrl+Shift+F | Cmd+Option+F |
| Device toolbar | Ctrl+Shift+M | Cmd+Shift+M |
| Hard reload (with DevTools open) | Right-click the reload button → Empty Cache and Hard Reload | |
Framework extensions#
Add the official extensions for your stack: React Developer Tools (component tree, props, the Profiler for slow renders), Vue.js devtools, Angular DevTools and Redux DevTools (time-travel through state changes). They plug in as extra DevTools tabs.
Key takeaways#
- DevTools opens with F12 and the Command Menu (Ctrl/Cmd+Shift+P) finds any feature quickly.
- Elements edits HTML/CSS live; Console runs code and shows errors with links to the exact line.
- Use breakpoints (conditional, XHR, event listener) in Sources instead of scattering console.log.
- The Network panel shows every request; the longest Timing phase tells you whether to fix the server, the file size or the request count.
- Performance finds long tasks and layout shifts; Memory finds leaks and detached DOM nodes.
- Application manages storage, cookies and service workers; Lighthouse gives an automated audit.