User Agents

Web browsers and everyday web tech, explained

Capture Chrome DevTools Network Traffic & Save HAR Files

· 5 min read · Browsers

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Capturing network traffic in Chrome DevTools and saving it as a HAR (HTTP Archive) file lets you record every request, response, header, and timing detail from a web page. This is essential for debugging slow loads, analyzing API calls, or sharing a session with a developer—all without needing a live connection later. You can open the HAR file in tools like Chrome's own HAR viewer or online analyzers. You only need Chrome and the page you want to inspect.

What You'll Need

  • Google Chrome (any recent version)
  • A web page you can load and interact with
  • Optional: a text editor or HAR viewer to inspect the saved file

Step-by-Step

  1. Open Chrome DevTools. Right-click anywhere on the page and select Inspect, or press F12 (Windows/Linux) or Cmd+Option+I (Mac).
  2. Go to the Network panel. In the DevTools toolbar, click the Network tab. If you don't see it, click the >> arrow to reveal more tabs.
  3. Enable recording. The recording button (a round red circle) should be red and active. If it's grey, click it to start recording. You'll see a red dot at the top-left of the Network panel.
  4. Clear existing logs (optional). Click the Clear button (the crossed-out circle icon) to remove any previous requests. This gives you a clean slate.
  5. Reproduce the activity you want to capture. Reload the page by pressing Ctrl+R (Windows/Linux) or Cmd+R (Mac), or navigate and interact with the page (click buttons, submit forms, etc.) to generate the traffic you need.
  6. Stop recording. Once you have all the requests you need, click the red record button again to stop. This prevents extra noise from being added.
  7. Export the HAR file. In the Network panel, click the Export HAR icon (downward arrow with a line under it) located in the toolbar. If you don't see it, click the three-dot menu (⋮) on the right and select Export HAR.
  8. Choose a location and save. A file dialog will appear. Name your file (e.g., session.har) and choose a folder. Click Save.
  9. Verify the file. Navigate to the saved location and open it with a text editor or a HAR viewer. You should see JSON content with a log object containing all captured entries.

Common Mistakes

  • Forgetting to clear the log before capturing. If you don't clear, you'll include unrelated requests from earlier browsing, making the HAR file messy.
  • Recording too much. Leaving the recorder on while doing other tasks adds junk. Stop recording as soon as you've captured what you need.
  • Not reproducing the exact scenario. If you need to capture a specific action (like a login), you must perform that action while recording. Simply loading the page won't capture it.
  • Saving before the page finishes loading. If you export too early, you may miss late-loading requests (e.g., lazy-loaded images or XHR calls). Wait a few seconds after the page settles.
  • Using the wrong export button. The export icon is not the same as the save icon. Look for the arrow pointing down with a horizontal line—that's the HAR export.

Tips

  • Use the filter box. Before exporting, you can filter by type (e.g., XHR, JS, CSS) to focus on specific requests. The HAR file will only include what's currently shown.
  • Preserve log for redirects. If you're capturing a flow with redirects, check the Preserve log checkbox (top-left of the Network panel) so previous requests aren't cleared on navigation.
  • Disable cache for accurate timings. To see real network loads, check the Disable cache checkbox in the Network panel (under the Network conditions tab) before reloading.
  • Name your HAR file descriptively. Include the date and purpose, like login-flow-2025-01-15.har, to avoid confusion later.
  • Use HAR viewers for analysis. Tools like the Chrome extension 'HAR Viewer' or online analyzers can visualize the data, showing waterfall charts and response sizes.

Troubleshooting

  • No requests appear in the Network panel. Make sure recording is on (red dot). If it's off, click it. Also, check if you're on a browser extension or internal page—those may not show network activity.
  • The Export HAR button is greyed out. This usually means there are no recorded requests. Clear the log, reload the page, and try again.
  • The HAR file is empty or very small. You likely exported before any requests were captured. Stop recording, clear, reload, and export again.
  • HAR file won't open in a viewer. Ensure the file extension is .har and the content is valid JSON. If you edited it, check for syntax errors.
  • Missing requests after a redirect. Enable Preserve log before starting the capture. Without it, Chrome clears the log on each navigation.
  • HAR is huge and slow to load. This is normal for complex pages. Use a viewer that can handle large files, or filter the requests before exporting.

Frequently Asked Questions

Can I capture HTTPS traffic in HAR?

Yes, Chrome DevTools captures HTTPS requests just like HTTP. The HAR file includes the encrypted request and response headers, but not the decrypted body content (unless you have SSL logging enabled).

Does the HAR file include cookies and personal data?

Yes, HAR files can contain cookies, tokens, and other sensitive data. Be careful when sharing them—redact or remove sensitive information before sending.

Can I record traffic from a mobile device?

Yes, you can use Chrome's remote debugging to capture traffic from an Android device via USB. On iOS, you'd need to use Safari's Web Inspector instead.

How long can I record?

There's no time limit, but the file size grows with each request. For long sessions, consider stopping and saving periodically to avoid a massive file.

Can I edit a HAR file after saving?

Yes, since it's JSON, you can edit it in any text editor. You can remove entries, change headers, or trim the data before sharing.

Is there a way to capture network traffic without opening DevTools?

You can use the Chrome DevTools Protocol via command line (e.g., chrome --remote-debugging-port=9222) and a script to capture traffic, but that's more advanced. For most users, opening DevTools is the simplest method.