Security operations
How to View and Sanitize HAR Files Offline (Chrome, Firefox, Safari)
How to capture a HAR file in Chrome, Firefox and Safari, open and analyze it as a waterfall, and remove cookies, tokens and passwords before you share it.
To view a HAR file, open it in a HAR viewer that draws the requests as a waterfall; to share it safely, sanitize it first so cookies, tokens and passwords are removed. Support teams ask for HAR files constantly, and most people send them without realising they contain a working copy of their login session.
This guide covers how to capture a HAR file in each major browser, how to open a .har file and read its waterfall, and how to redact it offline. The examples use the HAR viewer and sanitizer, which parses the file in your browser tab and never uploads it.
What is a HAR file?
A HAR (HTTP Archive) file is a JSON log of every request a browser made while recording, with headers, cookies, bodies and per-request timings.
The format is HAR 1.2: a log object with pages and an entries array. Each entry stores the request, the response, the start time and a timings object. That level of detail is why HAR files are so useful for debugging, and why they are risky to share.
{
"startedDateTime": "2026-11-14T09:30:00.420Z",
"time": 214,
"request": { "method": "POST", "url": "https://portal.example/api/login",
"headers": [{ "name": "cookie", "value": "portal_session=…" }] },
"response": { "status": 200, "content": { "mimeType": "application/json" } },
"timings": { "blocked": 1, "dns": 0, "connect": 0, "send": 1, "wait": 210, "receive": 2 }
}How do you capture a HAR file in Chrome, Firefox and Safari?
Open developer tools, go to the Network tab, enable log preservation, reproduce the problem, then use the export or download button to save the HAR.
| Browser | Open tools | Export |
|---|---|---|
| Chrome / Edge | F12 or Cmd+Opt+I → Network | Tick Preserve log, reproduce, click the download arrow (Export HAR) |
| Firefox | F12 or Cmd+Opt+I → Network | Tick Persist Logs, reproduce, gear menu → Save All As HAR |
| Safari | Enable Develop menu, Cmd+Opt+I → Network | Tick Preserve Log, reproduce, click Export |
Recent Chrome versions export a "sanitized" HAR by default that omits cookies and authorization headers, but URLs, request bodies and response bodies are still included. Treat every HAR as sensitive, whichever browser produced it.
How do you open a .har file?
Drop it into a HAR viewer, or import it into the Network tab of any browser's developer tools; it is plain JSON, so a text editor works too.
- Open the HAR viewer and drop the
.harfile, or load the sample session. - Read the summary: request count, bytes transferred, page time, HTTP errors and secrets found.
- Scan the waterfall for red statuses and long bars, then hover the timing segments.
- Use the secret inventory to see which values would leak if you shared the raw file.
Chrome DevTools can also import a HAR by dragging it onto the Network panel, but it loads the file into a browser profile that may sync. A standalone viewer keeps the data in one tab that you close afterwards.
How do you analyze a HAR file waterfall?
Find the slowest and failing requests, then look at which timing phase dominates each one, because each phase points at a different cause.
| Phase | Measures | Long value usually means |
|---|---|---|
| blocked | Queued in the browser | Too many requests to one host, or a busy main thread |
| dns | Name resolution | Slow or failing DNS resolver |
| connect | TCP handshake | Network latency or packet loss |
| ssl | TLS handshake | Distant server, slow certificate checks |
| wait | Time to first byte | Slow server, database or API backend |
| receive | Downloading the body | Large response or limited bandwidth |
total time = blocked + dns + connect + ssl + send + wait + receive (phases that did not happen are -1 in the file and count as 0)
Look for patterns as well as single slow requests: a chain of redirects, an API call that blocks everything after it, or plain http:// requests on an HTTPS page. If you also captured packets, the PCAP analysis guide shows how to confirm network-level causes.
What sensitive data does a HAR file contain?
A HAR file can contain session cookies, bearer tokens, API keys, OAuth codes, passwords from login forms and personal data in response bodies.
- Cookies and Set-Cookie headers: a session cookie lets anyone holding the file act as you until it expires.
- Authorization headers:
BearerJWTs and API keys grant API access directly. Inspect any token you find with the JWT Decoder to see when it expires. - URLs: OAuth
code,access_tokenand signed-URL parameters are often in query strings. - Request bodies: login forms post usernames and passwords in clear text inside HTTPS.
- Response bodies: user profiles, tickets and customer records.
In 2023, attackers used session tokens taken from HAR files shared with a vendor's support system to hijack customer sessions. Sanitizing before sharing closes exactly that gap.
Where exactly do secrets hide inside a HAR entry?
Secrets sit in eight places per entry: request and response headers, the request and response cookies arrays, the URL, the queryString array, the posted form or JSON body, and the response body.
The same value is often stored twice. A browser writes the session cookie into the Cookie request header and again into the parsed request.cookies[] array, and it writes an API key into both the URL and request.queryString[]. A sanitizer that only edits headers, or only rewrites the URL, leaves the second copy in the file. That is the most common way a "sanitized" HAR still leaks a working session.
| JSON path | Typical secret | Redaction |
|---|---|---|
| request.headers[] | Authorization, Cookie, X-API-Key, Proxy-Authorization | Replace the value |
| response.headers[] | Set-Cookie, Location with tokens | Replace the value or the token parameter |
| request.cookies[] | session_id, csrftoken | Replace every cookie.value |
| response.cookies[] | auth_token set by the server | Replace every cookie.value |
| request.url | api_key, access_token, code, sig | Replace the parameter value |
| request.queryString[] | The same parameters, parsed | Replace param.value |
| request.postData | password fields, refresh tokens in JSON | Replace the field, keep the structure |
| response.content.text | Tokens and personal data in JSON | Replace keys, or drop the body |
The HAR sanitizer scans all eight and counts each kind in its own green pill: auth headers, cookies, URL tokens, body secrets and JWTs. A parameter that appears in both the URL and queryString[] is redacted in both places but counted once, so the totals match the number of distinct leaks per request.
How do you sanitize a HAR file before sharing it?
Replace every cookie, auth header, token parameter, password field and JWT with a placeholder, keep the HAR structure valid, and share the cleaned copy.
- Open the file in the HAR sanitizer and switch to the Sanitize & redact tab; the inventory lists every secret with a masked preview.
- Keep the defaults (cookies, auth headers, URL tokens, body secrets and JWTs) and tick Drop all response bodies if they hold customer data.
- Download the
.sanitized.harcopy and spot-check it: search for[REDACTED]and for your session cookie name. - Send only the sanitized file, and delete the original from Downloads.
# List every header name that is still present, with a count
jq -r '.log.entries[].request.headers[].name' portal.sanitized.har | sort | uniq -c
# Confirm no cookie values survived
jq -r '.log.entries[].request.cookies[]?.value' portal.sanitized.har | sort -uIf a raw HAR already left your machine, sanitizing later does not help. Sign out of all sessions or revoke the tokens so the leaked values stop working.
How do you open and sanitize a very large HAR file?
Use a viewer that pages the request table and counts secrets from a one-time inventory, and only builds the cleaned copy when you press Download; drop response bodies to shrink the file.
A long session against a single-page application easily reaches 40 MB or more, because every JSON response body is stored inline. Viewers that rebuild a fully redacted copy each time you tick an option freeze the tab at that size. The LocalSecTools sanitizer works in three steps instead:
- Parse once. The file is read and a secret inventory is built in a single pass. Response bodies over 32 KB are sampled (their first 4 KB) for the preview counts.
- Count, do not copy. Ticking an option only recounts the inventory, which takes a few milliseconds even with 20,000 secrets. The secrets table shows 100 rows per page.
- Build on demand. The deep copy, the full-body redaction and the JSON serialisation run once, when you press Download sanitized .har, while the button shows a progress spinner.
On a 42.7 MB test file with 5,000 entries, the download held exactly 5,000 auth headers, 10,000 cookies, 5,000 URL tokens and 5,000 response bodies redacted, with no original value left. With response bodies dropped, the sanitized file was 4.1 MB. Copy output puts a bounded summary and the first 500 requests on the clipboard (about 50 KB) rather than the whole file, and it works on plain-HTTP intranet addresses where the browser clipboard API is unavailable.
How do you read a HAR file without a viewer?
A HAR file is JSON, so jq can list URLs, statuses and timings directly from the terminal.
# Status, total time and URL for every request
jq -r '.log.entries[] | "\(.response.status)\t\(.time|floor) ms\t\(.request.url)"' session.har
# The 10 slowest requests
jq -r '.log.entries | sort_by(-.time)[:10][] | "\(.time|floor) ms \(.request.url)"' session.har
# Every failing request
jq -r '.log.entries[] | select(.response.status >= 400) | "\(.response.status) \(.request.url)"' session.harThis is handy on a server or in a script. For anything visual, such as spotting which phase dominates a slow page, the waterfall is faster to read.
Should you send a HAR file or a PCAP?
Send a HAR file for problems inside the browser and web application, and a PCAP for problems below HTTP, such as DNS failures, TCP resets or TLS handshake errors.
A HAR shows decrypted requests exactly as the browser saw them, but nothing about packets. A PCAP shows every packet on the wire, but HTTPS content stays encrypted unless you also log TLS keys. For a login loop or a CORS error, a HAR is enough. For "the site sometimes does not load at all", ask for both.
Frequently asked questions
Open them in a HAR viewer that shows a request waterfall, such as the LocalSecTools HAR viewer, or import them into a browser's Network panel.
Try it in your browser
- PCAP & HAR AnalyzerOpen PCAP, PCAPNG, HAR and EVTX files in the browser: packet table, decoder, tcpdump output, HAR sanitizer and triage.
- JWT DecoderSplit a token into header, payload and signature, audit claims and verify HMAC signatures.
- Log DeobfuscatorDecode Base64, PowerShell, hex, URL and gzip with auto-detect, plus text-to-binary, dec-to-hex and an ASCII table.
About the author: Asad Ali
IT Support Engineer and SOC analyst · Microsoft SC-200 & ISC2 CC certified
Asad Ali is an IT Support Engineer and SOC analyst with a Computer Science degree from UET Lahore. He holds the Microsoft SC-200 Security Operations Analyst and ISC2 Certified in Cybersecurity (CC) certifications, works on threat detection, network analysis and Linux administration, and builds and maintains every tool on LocalSecTools.
- Microsoft Certified: Security Operations Analyst (SC-200)
- ISC2 Certified in Cybersecurity (CC)
Every guide is written and technically reviewed by Asad Ali, and the commands and numbers are checked against the LocalSecTools calculators. Read more about his work at asadali.tech.