Curl to Code Converter

Paste a curl command, pick a target language. Generates fetch, requests, Cypress, or Playwright code.

Runs 100% client-side
Copy output
On this page4 sections
Target:
curl command
Generated code
Code will appear here…

HOW TO USE

  1. 01Paste a curl command — multi-line continuations (lines ending in \) are supported.
  2. 02Pick a target language. Recognized flags: -X, -H, -d, --data*, -u, -b, -A, -e.
  3. 03JSON request bodies are detected automatically and emitted as native objects (e.g. JSON.stringify, json=, data:).

WHEN TO USE

Use this when you copy a curl command from browser DevTools, Postman, API documentation, or a bug report and need to turn it into test code. It handles the mechanical translation of flags (-X, -H, -d, -u, -b, -A) into the request method, headers, body, auth, and cookies of the target language. Use it as the first step when adding a new API endpoint to your test suite — paste the working curl, generate the scaffold, then add assertions.

WHAT BUGS THIS FINDS

  • Header casing inconsistency

    A server rejects a request because Content-Type is sent as content-type in the generated code — inspect the converted output to confirm header names match the casing the API expects.

  • Body encoding mismatch

    A -d flag with form data is converted as a JSON body (or vice versa) when Content-Type is ambiguous — verify the generated body encoding matches what the curl command actually sends.

  • Auth flag lost in translation

    The -u user:password flag translates to Basic Auth in curl but may be omitted or incorrectly placed in the generated code — confirm the Authorization header is present and correctly base64-encoded.

  • Multi-line curl parsed incorrectly

    A curl command copied from docs with line continuations (\) may have extra whitespace added by the terminal — the converter handles continuations explicitly, surfacing parse errors before the code is executed.

QA USE CASES

01

API test scaffold from DevTools

Copy a request from browser DevTools as curl, convert to your test language, and use the output as the starting point for a new test case — all headers, auth, and body included.

02

Bug reproduction test from curl

Convert a curl command from a bug report into the same language as your test suite to create a reproducible failing test that validates the fix when it passes.

03

Auth endpoint coverage

Convert the curl examples from an API's authentication docs into test code for each auth method (Basic, Bearer, cookie) to build out auth coverage quickly without writing boilerplate.