Sub topic 1
Opening DevTools and finding your way around
This chapter covers how to open Chromium DevTools, how the interface is organized, and which panel to open for which kind of problem. It also sets up a diagnostic workflow that the later chapters build on. Panel names follow Chromium-based browsers such as Chrome and Edge. Firefox and Safari provide equivalent tools under similar names.
Prerequisites
This chapter assumes you have:
- Basic HTML and CSS, enough to read a stylesheet and recognize a tag, a class and an id.
- Basic JavaScript syntax, enough to read a function and a variable declaration.
- A general idea of how a browser loads a page: it requests an HTML document, parses it, then requests the stylesheets, scripts and images the document refers to.
- A basic understanding of HTTP requests and responses, including methods, status codes and headers.
You also need a Chromium-based browser installed. Any ordinary web page works for the practice steps, and a page you control is best because you can edit and reload it freely.
What DevTools is
DevTools is a set of debugging and inspection tools built into the browser. It is not a separate program. It connects to the page you are viewing and reads the browser's own internal state: the parsed document, the computed styles, the loaded scripts, the network log, the stored data and the performance timeline.
Two ideas matter from the start.
- DevTools shows the live state, not your source files. The Elements panel shows the DOM (Document Object Model) as it exists now, after scripts have changed it. That can differ from the HTML your server sent. The Network panel's response view shows the original text. Knowing which view you are looking at prevents a lot of confusion.
- Edits in DevTools are temporary. Changes you make to the DOM, to CSS and to variables in a paused script live in the page's memory. Reloading discards them. DevTools is for experimenting and diagnosing. The permanent fix goes in your source code.
Opening DevTools
You can open DevTools several ways. Pick the one that fits what you are doing.
| Action | Windows / Linux | macOS |
|---|---|---|
| Open DevTools | F12 or Ctrl+Shift+I | Cmd+Option+I |
| Open with the Console focused | Ctrl+Shift+J | Cmd+Option+J |
| Inspect the element under the pointer | Ctrl+Shift+C, then click | Cmd+Shift+C, then click |
| Open the Command Menu | Ctrl+Shift+P | Cmd+Shift+P |
| Open Quick Open (files by name) | Ctrl+P | Cmd+P |
You can also right-click any element on the page and choose Inspect. This is usually the fastest route to a specific element, because DevTools opens with that element already selected in the Elements panel.
Shortcuts can differ by browser version and operating system. If one does not work, use the browser's three-dot menu and look under More tools, then Developer tools.
Docking and sizing
DevTools can sit in different places relative to the page. Open the three-dot menu in the DevTools toolbar and look at Dock side. The options are:
- Undock into separate window, useful on a second monitor.
- Dock to left.
- Dock to bottom, which gives a wide view that suits long Network and Performance listings.
- Dock to right, which keeps the page tall and suits layout work.
Docking changes the size of the page viewport. If a layout looks different when DevTools is open, the narrower viewport is often the reason. Undocking avoids this. Keep it in mind when you debug responsive behavior, because a docked panel can trigger a media query that a full-size window would not.
The layout of the interface
The DevTools window has a few regions. Learning their names makes documentation and error messages easier to follow.
- Toolbar and tab bar. The row of tabs across the top, one per panel. Tabs that do not fit are hidden behind a >> overflow button.
- Main pane. The area of the active panel. Most work happens here.
- Sidebar panes. Many panels have a secondary area. In the Elements panel, for example, the sidebar holds Styles, Computed, Layout and other tabs.
- Drawer. A secondary region that opens at the bottom of any panel. Press Esc to show or hide it. It can hold the Console, Search, Rendering, Network conditions and other tools. This lets you keep the Elements panel in view while you run code in the Console.
- Settings. The gear icon opens preferences such as theme, panel layout and experiments.
The panels and what each one answers
Each panel exists to answer a particular kind of question. The most useful habit you can build is to match the symptom to the panel before you start clicking.
| Panel | What it shows | Typical question |
|---|---|---|
| Elements | The live DOM and the CSS applied to each node | Why does this element look wrong? |
| Console | Logged messages, errors, and a place to run JavaScript | What error is the page throwing? |
| Sources | Loaded files, breakpoints, call stack and scope | Why does this function return the wrong value? |
| Network | Every request, with timing, headers and bodies | Why is this resource slow, missing or not cached? |
| Performance | A recorded timeline of scripting, layout and painting | Why does the page feel janky? |
| Memory | Heap snapshots and allocation data | Why does memory keep growing? |
| Application | Cookies, local storage, caches and service workers | What data is the page storing? |
| Lighthouse | An automated audit with scored findings | What are the biggest quality problems overall? |
Some panels may be hidden by default and appear under the >> menu or the three-dot menu, then More tools. In some versions the Memory and Performance panels also have a combined or renamed home. Look for the name, not the position.
How the panels connect
The panels are not isolated. A single problem often moves between them. The concept map for this tutorial reflects that. You usually start in Elements, Console or Network, and move into deeper tools from there.
The following chapters follow this order. Elements and CSS inspection come first because they are the quickest to practice. The Console leads to debugging in Sources. The Network panel leads to storage inspection, emulation and performance work. Performance leads to Memory and Lighthouse.
Navigating quickly
Clicking through tabs works, but a few features make you much faster.
The Command Menu
Press Ctrl+Shift+P (Cmd+Shift+P on macOS) to open the Command Menu. It is a searchable list of nearly every action in DevTools. Type a few letters and press Enter. Useful examples:
Screenshotoffers several capture options, including a full-page screenshot and a node screenshot.Show Renderingopens the Rendering tool in the drawer.DarkorLightswitches the DevTools theme.Disable JavaScriptturns off script execution for the page, which helps you check that content works without it.- A panel name, such as
Network, jumps straight to that panel.
When you cannot remember where a feature lives, the Command Menu is the fastest way to find it.
Quick Open
Ctrl+P (Cmd+P on macOS) opens Quick Open, which searches loaded files by name. You can jump to a script or stylesheet without browsing the file tree in Sources. Type : followed by a number after a filename to jump to a line. For example, app.js:42 opens that file at line 42.
Searching across everything
Press Ctrl+Shift+F (Cmd+Option+F on macOS) to open the Search tool in the drawer. It searches the text of every loaded resource, not only the open file. Use it to find where a CSS class, a function name or an API URL is defined. This is more reliable than guessing which file contains it. Inside the Elements panel, Ctrl+F searches the DOM by text, CSS selector or XPath expression.
Switching panels from the keyboard
Ctrl+[ and Ctrl+] (Cmd+[ and Cmd+] on macOS) move to the previous and next panel. You can also use the Command Menu by typing a panel name.
A first look at each area
Before moving to the detailed chapters, try a short tour. Open any page and do the following.
- Press F12 (or Cmd+Option+I). Note which panel opens. DevTools usually reopens on the last panel you used.
- Press Ctrl+Shift+C and click a heading on the page. The Elements panel selects that node, and the Styles sidebar shows the rules that apply to it.
- Press Esc to open the drawer. If the Console is not shown, use the drawer's menu to add it.
- In the Console, type
document.titleand press Enter. The page title is printed. - Open the Network panel and reload the page with Ctrl+R (Cmd+R). Requests fill the list. Click the first one, which is normally the HTML document, and read its Headers tab.
- Open the Application panel and expand Cookies in the left sidebar. Select the site to see what it stores.
This takes about two minutes and touches four of the major panels. The aim is orientation: knowing where each kind of data lives.
Setting up for reliable debugging
A few settings prevent confusing results later. Change them once, because DevTools remembers them.
- Disable cache (while DevTools is open). In the Network panel, tick Disable cache. Without it, the browser may serve old files and your edits seem to have no effect. The setting applies only while DevTools is open. Untick it when you test caching behavior on purpose.
- Preserve log. In both the Console and Network panels, Preserve log keeps entries across page loads and navigations. Turn it on when you debug a redirect or a form submission that reloads the page. Otherwise the log clears at the moment you need it.
- Source maps. If your code is built or minified, the Sources panel can show your original files when source maps are available. Check in Settings that JavaScript and CSS source maps are enabled.
- Theme and layout. A dark theme or a different dock side is a matter of preference, but a consistent setup makes screenshots and team instructions easier to follow.
Common errors and confusions
These problems cause most of the early frustration with DevTools.
- Your edits disappear. DevTools edits are not saved to your files. Copy the working change into your source and reload. (The Sources panel has a Workspaces feature that can write changes back to local files. It needs explicit setup.)
- The DOM does not match the page source. View Source shows what the server sent. Elements shows the DOM after JavaScript has run. Use Elements to see what the browser is rendering.
- The cache hides your changes. If a stylesheet or script edit has no effect, check the Network panel for a status such as
200 (from disk cache)or304, and enable Disable cache. - The viewport is smaller than expected. A docked DevTools reduces the page width. Undock it, or check the dimensions shown while emulating a device.
- A panel is missing. Check the >> overflow menu, then More tools. Some panels appear only after you enable them.
- Console output seems stale. The Console can clear on navigation. Enable Preserve log, and check the log level filter. If it hides Verbose or Info messages, they will not appear.
- The inspected target is wrong. A page can contain iframes and workers. The JavaScript context dropdown at the top of the Console, usually labeled
top, controls which frame your code runs in. Ifdocumentdoes not return what you expect, check it.
Differences in other browsers
The concepts carry over almost unchanged, though names and layout differ.
| Chromium name | Firefox name | Safari name |
|---|---|---|
| Elements | Inspector | Elements |
| Console | Web Console | Console |
| Sources | Debugger | Sources |
| Network | Network | Network |
| Application | Storage | Storage |
| Performance | Performance | Timelines |
Safari requires you to enable the developer menu first: open Safari Settings, go to the Advanced tab, and tick the option to show features for web developers. Firefox opens its tools with F12 or Ctrl+Shift+I, much like Chromium. If you learn the model here, you can find the equivalent in any of them.
A repeatable starting workflow
Use this short sequence when you face an unfamiliar bug.
- Reproduce it with DevTools open, and note the exact symptom.
- Check the Console for errors. A red error with a file and line number often ends the search.
- Check the Network panel for failed or slow requests. Red entries and 4xx or 5xx status codes stand out.
- Inspect the element in the Elements panel if the problem is visual.
- Choose a deeper tool only when the first three steps do not explain it: Sources for logic, Performance for slowness, Memory for growth.
This order moves from cheap and common checks to expensive and rare ones. It saves time because most bugs show up in the first three steps.
Exercise
You change a CSS rule in your editor and reload the page, but the page looks the same. DevTools is open. Name two places or settings in DevTools you would check to find out why, and say what each one tells you.
Show answer
First, open the Network panel and look at the stylesheet request. A status such as 200 (from disk cache) or 304 means the browser used an old copy, so tick Disable cache and reload. Second, open the Elements panel, select an affected element and read the Styles sidebar. It shows whether your new rule is present and whether another rule overrides it. You could also use Quick Open (Ctrl+P or Cmd+P) to view the stylesheet that was actually loaded and compare it to your edited file.
Exercise
Which keyboard shortcut opens the Command Menu on Windows, and what is one thing you can do with it that does not have a dedicated button in the main toolbar?
Show answer
Ctrl+Shift+P (Cmd+Shift+P on macOS). Examples include capturing a full-page screenshot, disabling JavaScript for the page, switching the theme, or opening the Rendering tool in the drawer.