Convert curl to HAR
Convert curl commands to HAR (HTTP Archive) format. curl2code runs entirely in your browser via WebAssembly — your data stays private. For raw HTTP, try our curl to HTTP converter. For JSON, see curl to JSON. Below are ready-to-use HAR examples.
How to copy curl from your browser
- 1
Open DevTools
Press F12 or Ctrl+Shift+I to open your browser developer tools.
- 2
Go to the Network tab
Click the Network tab and perform the action that triggers the HTTP request.
- 3
Copy as cURL
Right-click the request → Copy → Copy as cURL. Then paste it above.
Frequently Asked Questions
What is the HAR format?
HAR (HTTP Archive) is a JSON-based format for recording HTTP transactions. It captures requests, responses, headers, cookies, timings, and content in a standardized structure defined by the W3C. Browsers export HAR from DevTools Network tab. curl2code converts curl commands to HAR entries for analysis and replay.
HAR vs raw HTTP vs JSON output — which format to use?
HAR is best for browser-compatible analysis — importable in Chrome/Firefox DevTools. Raw HTTP shows the actual protocol format. JSON gives a structured representation for programmatic use. Choose based on your workflow: HAR for debugging, JSON for processing. See also curl to HTTP and curl to JSON.
How are authentication headers represented in HAR?
Auth headers appear in the headers array of the HAR request entry: {"name": "Authorization", "value": "Bearer token"}. HAR preserves all headers exactly as sent. Be cautious when sharing HAR files — they may contain sensitive auth tokens. Strip credentials before sharing.
How is form data represented in HAR?
Multipart form data appears in postData with mimeType: "multipart/form-data" and a params array listing each field. File contents may be included as text or base64-encoded. The text field contains the raw body. curl2code generates the complete postData structure.
How to validate a HAR file?
Check the required fields: log.version, log.creator, and log.entries array. Each entry needs request and response objects. Use HAR validators like har-validator npm package. Import into Chrome DevTools (Network > Import HAR) to verify the structure visually.
How to parse and analyze HAR files?
HAR is JSON — parse with any JSON library. Key paths: log.entries[].request.url for URLs, log.entries[].time for total time, log.entries[].response.content.size for response size. Tools like har-analyzer provide performance insights. For programmatic analysis, see curl to JavaScript.
How to use HAR for debugging?
Export HAR from browser DevTools (Network tab > Export HAR), share with team members, and import in their browser for replay. HAR captures timing waterfall, redirects, and cookie flow. Use charles-proxy or mitmproxy for HAR generation from any HTTP client.
What tools work with HAR files?
Chrome/Firefox DevTools import HAR for visual analysis. mitmproxy and Charles Proxy export HAR. har-to-k6 converts HAR to load tests. httparchive.org uses HAR for web performance research. Postman imports HAR for collection creation. For raw format, see curl to HTTP.
How to represent a POST request with JSON body in HAR?
Use curl's -X POST -d "{"key":"value"}" -H "Content-Type: application/json" and curl2code will convert it to HAR format: { "method": "POST", "postData": { "mimeType": "application/json", "text": "..." } }. The JSON body and Content-Type header are preserved in the output. curl2code handles both inline JSON and @file.json references.
How to include Bearer token authorization in HAR?
When you convert curl -H "Authorization: Bearer YOUR_TOKEN" URL with curl2code, the Bearer token is preserved in the HAR output: { "name": "Authorization", "value": "Bearer YOUR_TOKEN" }. Both -H "Authorization: Bearer ..." and OAuth token flags are detected automatically.
How is Content-Type represented in HAR format?
When converting curl -H "Content-Type: application/json" URL, curl2code outputs the Content-Type in HAR as: { "name": "Content-Type", "value": "application/json" }. Common types include application/json, application/x-www-form-urlencoded, and multipart/form-data. curl2code preserves the exact Content-Type from the original curl command.