Skip to content
koducathome

cURL to HAR Converter

Convert curl commands to HAR code using HAR 1.2. Paste a command and the HAR snippet appears instantly — everything runs in your browser.

How to use this tool

Steps for using the cURL to Code.

  1. Copy a curl command — from API documentation, or from your browser's DevTools (Network tab → right-click a request → Copy as cURL (bash)).
  2. Paste it into Enter cURL command. The HAR 1.2 code appears instantly.
  3. Set up: No setup — the output is a JSON file.
  4. Run it: Save it as request.har and import it into tools that read HAR files, such as browser DevTools or API clients. Replace placeholders such as YOUR_TOKEN first, and check any notes under the editors for curl options that have no HAR 1.2 equivalent.

Example

GET with headers → HAR 1.2

curl command
curl 'https://api.example.com/v1/users?page=2' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR_TOKEN'
HAR 1.2
{
  "log": {
    "version": "1.2",
    "creator": {
      "name": "curl-to-code",
      "version": "1.0"
    },
    "entries": [
      {
        "request": {
          "method": "GET",
          "url": "https://api.example.com/v1/users?page=2",
          "httpVersion": "HTTP/1.1",
          "cookies": [],
          "headers": [
            {
              "name": "Accept",
              "value": "application/json"
            },
            {
              "name": "Authorization",
              "value": "Bearer YOUR_TOKEN"
            }
          ],
          "queryString": [
            {
              "name": "page",
              "value": "2"
            }
          ],
          "headersSize": -1,
          "bodySize": 0
        }
      }
    ]
  }
}

Common use cases

  • Sharing a request with a teammate or support
  • Importing a request into an API client
  • Documenting API calls

Converting curl to HAR 1.2

HAR (HTTP Archive 1.2) is a JSON format for recording HTTP requests. The output describes the request — URL, method, headers, query and body — in that format.

The converter reads the curl command the way curl does — the method (-X), headers (-H), request bodies (-d, --data-raw, --json, -F), query strings, basic auth (-u) and cookies — and writes the equivalent HAR 1.2 code. Options that have no HAR 1.2 equivalent are listed under the editors rather than silently dropped.

Limitations

  • Only the request is described — there is no response in the HAR.
  • The code is a starting point: add timeouts, retries and error handling for production use.
  • Secrets in the curl command are copied into the code — move them to environment variables before committing.

Frequently asked questions

What can open a HAR file?

Browser DevTools (Network panel) and many API clients and proxies can import HAR files.

Does the HAR include a response?

No. It's built from the curl command, so only the request is recorded.

Is my curl command sent to a server?

No. The conversion runs entirely in your browser, so tokens and passwords in the command never leave your device. Still, replace real secrets before sharing the generated code.