Introduction
A HAR file records what a web browser fetched while loading pages: every request and response, with headers, cookies, bodies and timings. Browsers’ developer tools save one from their Network panel, and support teams often ask for a HAR file to see why a site misbehaves.
A HAR file is JSON. Because it holds cookies, sign-in tokens and form data as they were sent, it should be treated as secret and cleaned before it is shared.
Structure
The top-level object has one member, log. It holds the format
version (usually 1.2), a creator naming the program that wrote
it, an optional browser, a list of pages with their titles and
load timings, and a list of entries, one per request.
Each entry gives the time the request started, its total time, the
request (method, URL, HTTP version, headers, cookies, query string and any
posted data), the response (status, headers, cookies, and the body under
content, as text or base64), cache details, and timings broken
into blocked, DNS, connect, SSL, send, wait and receive, in milliseconds.
{
"log": {
"version": "1.2",
"creator": { "name": "…", "version": "…" },
"pages": [ … ],
"entries": [
{ "startedDateTime": "…", "time": 120,
"request": { … }, "response": { … },
"cache": { }, "timings": { … } }
]
}
}
Links
Software
- Chrome and Edge DevTools, which export and import HAR files in the Network panel
- Firefox Developer Tools, which save and import HAR files
- Safari Web Inspector, which exports HAR files
- Charles Proxy (Windows, macOS, Linux)
- Fiddler (Windows, macOS, Linux)
Developers
- Playwright, browser automation for JavaScript, Python, Java and .NET, which records and replays HAR files
Reference
- HTTP Archive (HAR) format, the W3C draft specification