Testing & Debugging

Chrome DevTools

Chrome DevTools is every web developer's most powerful tool. Master the Console, Sources debugger, Network panel, and Performance profiler to find bugs fast, optimize loading, and understand exactly what your code is doing.

How do I use Chrome DevTools?

Press F12 (or Cmd+Option+I). The Elements panel inspects and edits HTML and CSS live, Console shows errors and runs JavaScript, Sources sets breakpoints and steps through code, Network shows every request with timing and responses, Performance records what slows the page, and Lighthouse audits speed, accessibility and SEO.

DevTools Panels Overview

Elements

Edit HTML/CSS live, inspect accessibility tree, computed styles

Console

REPL, log all errors, run arbitrary JS against the page

Sources

Debugger with breakpoints, watch expressions, Snippets

Network

All HTTP requests, timing, headers, response preview

Performance

Record & analyze CPU, rendering, FPS, long tasks

Memory

Heap snapshots, allocation timelines, detect leaks

Application

Storage (cookies, localStorage, IndexedDB), Service Workers

Lighthouse

Automated audits for Performance, SEO, Accessibility, PWA

Essential Keyboard Shortcuts

Open DevTools

F12 or Cmd+Option+IOpen/close DevTools
Cmd+Shift+CInspect element mode
Cmd+Option+JOpen directly to Console

Sources Debugger

F8 or Cmd+\Play/Pause execution
F10 or F9Step over / Step into
F11Step out of function
Ctrl+PGo to file

Console

Ctrl+LClear console
Shift+EnterMultiline without executing
↑ / ↓Navigate history

Elements

HToggle element visibility
F2Edit as HTML
Ctrl+ZUndo element edit
Ctrl+Shift+PCommand palette

Common Pitfalls

Leaving console.log() calls in production code — leaks internal data and hurts performance
Remove or guard with: if (process.env.NODE_ENV !== 'production') console.log(...)
Only using console.log() for debugging — missing the powerful Sources debugger
Use breakpoints (click line number or type 'debugger') to pause and inspect any variable's live value.
Profiling with the browser window too small or DevTools open — skews layout/repaint measurements
Profile in a private window with DevTools undocked to avoid measuring DevTools overhead itself.
Trusting the Console tab for production errors — minified code shows unhelpful line numbers
Upload source maps to your error monitoring (Sentry, Datadog) for production stack traces with real file/line.

Interactive Demo

Code Editor

<button id="run">Log some data</button>
<p>Open your browser's DevTools (F12) → Console to see the output.</p>

Preview

Browser DevTools: summary

Key points

  • Right-click any element and choose Inspect to jump straight to it.
  • Device mode (Ctrl/Cmd+Shift+M) simulates phones and slow networks.
  • In the Console, $0 refers to the element currently selected in Elements.
  • Throttle the CPU and network in the Performance panel to see what low-end phones experience.

Frequently asked questions

›How do I see network requests?

Open the Network tab and reload. Click a request to see its headers, payload, response and timing.