Skip to content

Browser developer tools (Chrome and Firefox)

Developer tools (DevTools) are a set of panels built into every browser that show what a page is made of and what it does: its code, the files it loads, the errors it reports and what it stores on your computer. Press F12 to open them. Developers cannot live without them, but they are useful to anyone who runs a website or wants to check what a site does with their data.

In short

  • F12 or Ctrl+Shift+I opens the tools, Ctrl+Shift+C lets you pick an element on the page.
  • Elements/Inspector lets you change HTML and CSS live; Network shows every request and its headers.
  • Chrome and Firefox have nearly the same panels. They differ in details and a few names.

A look under the bonnet

A website in your browser is like a car in a car park: you see the bodywork, not the engine. DevTools open the bonnet. You can look inside and even adjust things - changes show at once, but they only affect your browser and vanish when you reload. You cannot break anything 🙂

Elements / Inspector - HTML and CSS

The panel is called Elements in Chrome and Inspector in Firefox. Right-click anything on the page and choose "Inspect" (or press Ctrl+Shift+C and click). You will see its HTML, and next to it every CSS rule that applies, including the struck-through ones another rule has overridden.

What you can do here:

  • change CSS live - a colour, a gap, a font size - and see the effect before you touch the file,
  • edit text on the page (double-click in the HTML), to see how a longer title looks, for example,
  • find where a gap comes from - the element's box preview shows its margins and padding.

Firefox has an excellent grid and flexbox inspector here: it draws the layout lines right on the page.

Mobile view

Ctrl+Shift+M switches on device mode in both browsers. Pick a phone model or any width and see how the page looks on a small screen. It is not a real phone (Safari on an iPhone uses a different engine, touch is different), but it catches most layout problems.

Console - errors and JavaScript

The console (Chrome: Ctrl+Shift+J, Firefox: Ctrl+Shift+K) shows the page's errors in red and warnings in yellow. The page "does not work", a button does nothing? Look here first. You can also type any JavaScript and run it on the page; document.title, for instance, shows the page title.

Never paste code into the console that someone sent you with "paste this to unlock your account". Code in the console runs with your permissions on that site - a classic way of stealing accounts.

Network - what a page downloads and sends

In my view, the most important panel. Open it and reload the page: you will see every file downloaded, its size, its timing and its response code (200, 301, 404...). Clicking a file shows the details, including the headers.

What it is good for:

  • redirects - tick "Preserve log" ("Persist Logs" in Firefox) and you will see the whole chain: 301, then 302, then 200. Without it, the list clears on every redirect,
  • caching and compression - the Cache-Control and Content-Encoding headers (more in Speeding up a website with .htaccess),
  • noindex - the X-Robots-Tag header on PDFs or images,
  • a slow page - sort by size or time and you see at once which image weighs 5 MB,
  • privacy - you see which servers a page sends requests to. That is how you can check that Tools, for one, sends what you type nowhere.

"Disable cache" turns caching off while the tools are open, and throttling (e.g. "Slow 4G") shows how the page loads on a poor connection.

Application / Storage - what a site saves

In Chrome it is the Application tab, in Firefox Storage. Here you will find:

  • cookies - with names, values and expiry dates,
  • Local Storage and IndexedDB - data a site keeps in your browser. This is where your wheels from Wheel and your rooms from Rooms live, for example.

You can browse, edit and delete them - handy when testing how a site behaves on a first visit.

Chrome or Firefox?

For most work it does not matter. The panels are almost identical; the differences are mostly names and extras:

  • Chrome has Lighthouse built in, a one-click audit of speed, accessibility and SEO, and a powerful Performance panel,
  • Firefox has the best CSS Grid and flexbox tools, a fonts panel and a handy JSON viewer (open an address that returns JSON and you get a tree instead of a wall of text).

A good habit: check your site in both, because each browser occasionally draws something differently.

Tips

  • Ctrl+Shift+C - the quickest way to a specific element.
  • Ctrl+F in the Elements panel searches the page's code, CSS selectors included.
  • Ctrl+Shift+P in Chrome's DevTools opens a command palette; "Capture full size screenshot", for instance, captures the whole page.
  • Copying a request: right-click an entry in Network, "Copy as cURL" - and you can repeat the request in a terminal. Format a JSON response with the JSON formatter.
Advertisement