Inspect network activity

Kayce Basques
Kayce Basques

This is a hands-on tutorial of some of the most commonly-used DevTools features related toinspecting a page's network activity.

SeeNetwork Reference if you'd like to browse features instead.

Read on, or watch the video version of this tutorial:

When to use the Network panel

In general, use theNetwork panel when you need to make sure that resources are being downloaded oruploaded as expected. The most common use cases for theNetwork panel are:

  • Making sure that resources are actually being uploaded or downloaded at all.
  • Inspecting the properties of an individual resource, such as its HTTP headers, content, size, andso on.

If you're looking for ways to improve page load performance,don't start with theNetwork panel.There are many types of load performance issues that aren't related to network activity. Start withthe Lighthouse panel because it gives you targeted suggestions on how to improve your page. SeeOptimize Website Speed.

Open the Network panel

To get the most out of this tutorial, open up the demo and try out the features on the demo page.

  1. Open theGet Started Demo.

    The demo website.

    You might prefer to move the demo to a separate window.

    The demo in one window and this tutorial in a different window.

  2. Open DevTools by pressing Control+Shift+J or Command+Option+J (Mac). TheConsole panelopens.

    The Console panel in Devtools.

    You might prefer todock DevTools to the bottom of your window.

    DevTools docked to the bottom of the window.

  3. Click theNetwork tab. TheNetwork panel opens.

    Devtools Network panel docked to the bottom of the window.

Right now theNetwork panel is empty. That's because DevTools only logs network activity while it'sopen and no network activity has occurred since you opened DevTools.

Log network activity

To view the network activity that a page causes:

  1. Reload the page. TheNetwork panel logs all network activity in theNetwork Log.

    The Network Log with 5 requests.

    Each row of theNetwork Log represents a resource. By default the resources are listedchronologically. The top resource is usually the main HTML document. The bottom resource iswhatever was requested last.

    Each column represents information about a resource. The default columns are:

    • Status: The HTTP response code.
    • Type: The resource type.
    • Initiator: What caused a resource to be requested. Clicking a link in the Initiator columntakes you to the source code that caused the request.
    • Size: Resource amount transferred over the network.
    • Time: How long the request took.
    Note: The graph above the Network Log is called the Overview. You won't be using it in this tutorial, so you can hide it if you prefer. SeeHide the Overview track.
  2. So long as you've got DevTools open, it will record network activity in theNetwork Log. Todemonstrate this, first look at the bottom of theNetwork Log and take note of thelast activity.

  3. Now, click theGet Data button in the demo.

  4. Look at the bottom of theNetwork Log again. There's a new resource calledgetstarted.json. Clicking theGet Data button caused the page to request this file.

    A new resource in the Network Log.

Show more information

The columns of theNetwork Log are configurable. You can hide columns that you're not using. Thereare also many columns that are hidden by default which you may find useful.

  1. Right-click the header of theNetwork Log table and selectDomain. The domain of eachresource is now shown.

    Enabling the Domain column.

Tip: You can see the full URL of a resource by hovering over its cell in theName column.

Simulate a slower network connection

The network connection of the computer that you use to build sites is probably faster than thenetwork connections of the mobile devices of your users. By throttling the page you can get a betteridea of how long a page takes to load on a mobile device.

  1. Click theThrottling drop-down, which is set toNo throttling by default.

    The throttling drop-down in the Network panel.

  2. Select3G.

    Selecting 3G in the Network panel.

  3. Long-pressReload and then selectEmpty Cache And Hard Reload.

    Empty Cache And Hard Reload.

    On repeat visits, the browser usually serves some files from itscache, which speeds up thepage load.Empty Cache And Hard Reload forces the browser to go to the network for allresources. This is helpful when you want to see how a first-time visitor experiences a pageload.

    Note: TheEmpty Cache And Hard Reload workflow is only available when DevTools is open.

Capture screenshots

Screenshots capture how your page looks at different times while it loads, and reports what resources are loaded at each interval.

To capture screenshots, follow these steps:

  1. ClickNetwork Settings.

  2. Enable theScreenshots checkbox.

  3. Reload the page again using theEmpty Cache And Hard Reload workflow. SeeSimulate a slowerconnection if you need a reminder on how to do this. TheScreenshots tab providesthumbnails of how the page looked at various points during the loading process.

    Screenshots of the page load in the Network panel.

  4. Click the first thumbnail. DevTools shows you what network activity was occurring at that momentin time.

    The network activity that was happening during the first screenshot.

  5. Toggle theScreenshots checkbox to close the Screenshots tab.

  6. Reload the page again.

Inspect a resource's details

Click a resource to learn more information about it. Try it now:

  1. Clickgetstarted.html. TheHeaders tab is shown. Use this tab to inspect HTTP headers.

    The Headers tab in the Network panel.

  2. Click thePreview tab to view a basic HTML rendering.

    The Preview tab in the Network panel.

    This tab is helpful when an API returns an error code in HTML and it's easier to read therendered HTML than the HTML source code, or when inspecting images.

  3. Click theResponse tab to view the HTML source code.

    The Response tab in the Network panel.

    Tip: When a file is minified, clicking theFormat button at the bottom of theResponse tab re-formats the file's contents for readability.
  4. Click theInitiator tab to view a tree that maps the request initiator chain.

    The Initiator tab in the Network panel.

  5. Click theTiming tab to view a breakdown of the network activity for this resource.

    The Timing tab in the Network panel.

  6. ClickClose to view theNetwork Log again.

    The Close button for the details tab.

Search network headers and responses

Use theSearch tab when you need to search the HTTP headers and responses of all resources fora certain string or regular expression.

For example, suppose you want to check if your resources are using reasonablecache policies.

  1. ClickSearch. TheSearch tab opens to the left of theNetwork log.

    The Search tab to the left of the Network log.

  2. TypeCache-Control and press Enter. TheSearch tab lists all instances ofCache-Controlthat it finds in resource headers or content.

    Search results for Cache-Control.

  3. Click a result to view it. If the query was found in a header, the Headers tab opens. If thequery was found in content, theResponse tab opens.

    A search result highlighted in the Headers tab.

  4. Close theSearch tab and theHeaders tab.

    The Close buttons.

Filter resources

DevTools provides numerous workflows for filtering out resources that aren't relevant to the task athand.

The Filters toolbar.

TheFilters toolbar should be enabled by default. If not:

  1. ClickFilter to show it.

Filter by string, regular expression, or property

TheFilter input box supports many different types of filtering.

  1. Typepng into theFilter input box. Only the files that contain the textpng are shown.In this case the only files that match the filter are the PNG images.

    String filtering results in the Network log.

  2. Type/.*\.[cj]s+$/. DevTools filters out any resource with a filename that doesn't end with aj or ac followed by 1 or mores characters.

    Regular expression filter results in the Network log.

  3. Type-main.css. DevTools filters outmain.css. If any other file matched the pattern theywould also be filtered out.

    Negative filtering results in the Network log.

  4. Typedomain:raw.githubusercontent.com into theFilter text box. DevTools filters out anyresource with a URL that does not match this domain.

    Property filtering results in the Network log.

    SeeFilter requests by properties for the full list of filterable properties.

  5. Clear theFilter input box of any text.

Filter by resource type

To focus in on a certain type of file, such as stylesheets:

  1. ClickCSS. All other file types are filtered out.

    Network panel showing CSS files only.

  2. To also see scripts, hold Control or Command (Mac) and then clickJS.

    Network panel showing CSS and JS files only.

  3. ClickAll to remove the filters and see all resources again.

SeeFilter requests for other filtering workflows.

Block requests

How does a page look and behave when some of its resources aren't available? Does it failcompletely, or is it still somewhat functional? Block requests to find out:

  1. Press Control+Shift+P or Command+Shift+P (Mac) to open theCommand Menu.

    The Command Menu in the Network panel.

  2. Typeblock, selectShow Request Blocking, and press Enter.

    The 'Show Request Blocking' option.

  3. Click theAdd Pattern button.

  4. Typemain.css.

    Blocking main.css in Network panel

  5. ClickAdd.

  6. Reload the page. As expected, the page's styling is slightly messed up because its mainstyle sheet has been blocked. Note themain.css row in the Network Log. The red text means thatthe resource is blocked.

    main.css has been blocked.

  7. Clear theEnable request blocking checkbox.

To discover more DevTools features related to inspecting network activity, check out theNetwork Reference.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2024-10-14 UTC.