DevTools Logo

HAR to cURL Converter

HAR to cURL Converter

Pick requests from a HAR capture and rebuild them as ready-to-paste cURL commands. Headers, cookies and bodies included.

Runs in your browser
Cookie handling
Try an example

HAR capture

cURL commands

Can't build commands

Paste a HAR file or upload a capture to build cURL commands

Every captured request becomes a selectable command line.

Details

HAR to cURL Converter reads a browser network capture (HAR 1.2 JSON), lists every recorded request, and rebuilds selected ones as cURL commands. Each command keeps the original method, URL with query string, headers in order, cookies and POST body. Arguments use POSIX single-quote escaping and bodies use bash ANSI-C quoting so quotes, newlines and control characters survive a paste. Switch cookies between the original Cookie header and a --cookie flag, strip authorization/API-key headers and token query parameters for ticket-safe output, and add --compressed, --location or timing comments. Multiple requests are combined into one script with numbered comments; nothing is uploaded.

More examples

Replay a failing GET

The generated command is curl 'https://api.example.com/v1/users?limit=10' with an -H 'Accept: application/json' header; a GET does not need -X.

POST with a JSON body and cookie

The command carries -X POST, the Content-Type and Cookie headers, and --data-binary with the original JSON body.

Ticket-safe redaction

With Redact secrets on, the token query parameter becomes token=REDACTED and the Authorization header is removed; a note explains each change.

    Examples

    GET with headers

    Input
    {"log":{"entries":[{"request":{"method":"GET","url":"https://api.example.com/v1/users?limit=10","headers":[{"name":"Accept","value":"application/json"}]},"response":{"status":200}}]}}
    Output
    curl 'https://api.example.com/v1/users?limit=10' \
      -H 'Accept: application/json'

    GET needs no -X flag; the query string stays in the quoted URL and headers are emitted in order.

    POST with JSON body

    Input
    {"log":{"entries":[{"request":{"method":"POST","url":"https://api.example.com/v1/users","headers":[{"name":"Content-Type","value":"application/json"}],"postData":{"mimeType":"application/json","text":"{\"name\":\"Ann\"}"}}}]}}
    Output
    curl 'https://api.example.com/v1/users' \
      -X 'POST' \
      -H 'Content-Type: application/json' \
      --data-binary $'{"name":"Ann"}'

    The method, content type and raw body are reproduced without JSON re-serialization.

    Ticket-safe redaction

    Input
    https://api.example.com/orders?token=abc123 + Authorization: Bearer secret
    Output
    curl 'https://api.example.com/orders?token=REDACTED'

    Sensitive headers are dropped and token query values are replaced, with notes listing every change.

    About this tool

    The HAR to cURL Converter turns browser network captures into commands you can rerun. Load a .har file exported from DevTools, choose one or several requests, and the output pane assembles a cURL invocation with the original method, URL, query string, headers, cookies and request body. It is built for the common debugging moment when a support ticket needs a reproducible request but the reporter can only share a capture.

    Every argument is shell-escaped before it reaches the output. Header and URL arguments use POSIX single-quote escaping, so embedded quotes, dollar signs and backslashes stay literal. Request bodies use bash ANSI-C quoting ($'...'), which preserves newlines and tabs. Text bodies go to --data-binary; multipart captures become best-effort --form parts; urlencoded params are reassembled when the HAR stores only a param list.

    The redaction toggle removes Authorization, Cookie, Set-Cookie and API-key headers plus token, key and signature query parameters, replacing values with REDACTED and listing each change as a note. Cookie handling can keep the captured Cookie header or emit a --cookie flag, and optional flags add --compressed, --location and timing comments. Selected requests are combined into one script with numbered separators such as '# 1. GET /api/users → 200'.

    Conversion happens entirely in your browser. The HAR is parsed locally with a size guard of about 100 MB; very large bodies (>100 KB) are deliberately not inlined — the command references @body.bin with an explanation so you can save the payload separately.

    What this tool does not do

    • The whole HAR is parsed in memory with an approximate 100 MB cap; huge captures should be filtered before export.
    • Bodies larger than 100 KB are not inlined; the generated script references @body.bin and you must save the payload yourself.
    • Output targets POSIX shells with bash-style $'...' quoting; Windows cmd and PowerShell dialects are not emitted.

    How to use this tool

    1. Capture a HAR

      Open your browser's Network panel, reproduce the request, then export the log as a .har file. The tool also accepts pasted HAR JSON.

    2. Load and filter

      Paste the JSON or upload the .har file. The request list shows method, path, status and size; filter by method or search by URL, then check the requests you want to replay.

    3. Choose output options

      Keep cookies as a header or switch to --cookie, enable Redact secrets before sharing, and add --compressed, --location or timing comments if the reproduction needs them.

    4. Copy the script

      Copy the generated cURL commands or download requests.sh. Paste into a terminal, adjust the host or payload if needed, and rerun.

    Use cases

    Reproducing a customer bug

    A support engineer loads the customer's HAR, selects the failing request, redacts credentials and pastes a cURL repro into the ticket.

    Replaying an OAuth step

    Pick one step from a captured authentication flow to test a token exchange or refresh call in a terminal without rebuilding headers by hand.

    Building a regression script

    Select several requests to generate one numbered shell script, then save it as a smoke test for an API endpoint.

    Comparing captured and current responses

    Copy a request exactly as the browser sent it, including cookies and body, and rerun it against staging to isolate a change in behavior.

    How HAR fields map to cURL

    HAR field / optioncURL output and note
    request.method-X 'POST' — omitted for GET, which is cURL's default
    request.urlcurl 'https://...' — query string is kept; sensitive params can be redacted
    request.headers[]-H 'Name: value' — original order is preserved; HTTP/2 pseudo-headers are skipped
    request.cookies[] / Cookie--cookie 'a=1; b=2' — only in --cookie mode; otherwise the Cookie header stays
    postData.text--data-binary $'...' — bodies over 100 KB reference @body.bin instead
    postData.params (multipart)--form 'field=value' — best effort: HAR does not contain file contents

    Arguments use POSIX single-quote escaping (' → '\''). Bodies use bash ANSI-C quoting so control characters survive; PowerShell needs different escaping and is not emitted.

    Common mistakes

    Mistake:Sharing a raw cURL command with credentials.

    Fix:HAR captures often contain Authorization headers, session cookies and token query parameters. Turn on Redact secrets before pasting output into a public ticket, and still review the generated script.

    Mistake:Assuming the replay will be byte-identical.

    Fix:Cookies expire and CSRF or nonce values can be single-use. A reproduced request may need a fresh token; the converter builds the command but does not refresh credentials.

    Mistake:Pasting bash ANSI-C quoting into PowerShell or cmd.

    Fix:Bodies use $'...' quoting, which is bash/ksh/zsh syntax. On Windows, use a POSIX shell or translate the escaping before running the command.

    Mistake:Expecting multipart file uploads to work automatically.

    Fix:A HAR records field names and values but not file bytes. The tool emits --form parts for text fields and adds a note; attach real files yourself.

    Frequently asked questions

    How do I capture a HAR file?

    In Chrome, Edge or Firefox, open DevTools, go to the Network panel and make sure recording is on. Reproduce the request, then use the export/download button (often an arrow icon) to save the log as a .har file. Drag that file onto the upload action or paste its JSON into the input panel here.

    Does the converter include headers, cookies and POST bodies?

    Yes. Generated commands keep the request URL with its query string, every header in its original order, cookies and the body from postData. Cookies can stay as a Cookie header or be emitted as a --cookie flag. Text bodies use --data-binary; urlencoded params are rebuilt when the HAR has only a param list, and multipart fields become --form parts.

    Are sensitive headers included in the output?

    By default the command reproduces what was captured. Turn on Redact secrets to drop Authorization, Cookie, Set-Cookie and API-key headers and replace token, key and signature query values with REDACTED. Each change is listed as a note above the output, so you can see exactly what was removed before sharing the script.

    Why does my big POST body become @body.bin?

    Bodies larger than about 100 KB are not inlined into the command: embedding them would make the output unwieldy and error-prone. The generated command references --data-binary @body.bin and a note explains how to save the original body next to the script. Small bodies are emitted inline with shell-safe quoting.

    Can I convert several requests at once?

    Yes. After loading a HAR, check the requests you want in the list; the output becomes one shell script with numbered comment separators such as '# 1. GET /api/users → 200'. Filter by HTTP method or search the URL text when a capture contains hundreds of entries.

    Is my HAR uploaded or stored anywhere?

    No. Parsing, selection, redaction and command generation happen in your browser tab. Nothing is sent to a server or logged, and the page keeps working if you go offline after it loads.

    References & standards