# cURL to code

> Paste a cURL command and get the equivalent request code in your language.

cURL to code converts a cURL command into the equivalent HTTP request written in your language, so a command copied out of documentation or browser devtools becomes code you can paste into a project.

Also: curl to code, convert curl to python, curl to javascript, curl to fetch, curl to node, curl to php, curl to go, convert curl command.

## What it does

cURL is how HTTP requests get shared — in API docs, in bug reports, in "copy as cURL" from a browser network tab. It is not how they get written in an application. This tool parses the command, breaks out the method, URL, query parameters, headers and body, and re-emits the same request using the idiomatic HTTP client for TypeScript, Python, Go, Java, PHP or C#.

## When to use it

- API documentation gives you a cURL example and you need it in your codebase.
- You copied a request as cURL from browser devtools and want to reproduce it in a script.
- A colleague sent a failing request as a cURL command and you need to run it from a test.
- You want to see how the same request looks across several languages.

## What you give it

| Input | Meaning |
| --- | --- |
| cURL command | A complete command, including its flags. Line continuations are fine. |
| Target language | TypeScript, Python, Go, Java, PHP or C#. |

## What you get back

| Output | Meaning |
| --- | --- |
| Request code | The same request expressed with the idiomatic HTTP client for the language you picked. |
| Parsed request breakdown | Host, path, query parameters, headers and body, listed separately so you can confirm the command was read the way you intended. |

## Key terms

- **cURL** — a command-line HTTP client. Its flags have become the lingua franca for sharing a request: -X sets the method, -H adds a header, -d sends a body.
- **Request body** — the payload sent with a POST, PUT or PATCH. cURL infers the method from the presence of a body, which is why a command with -d and no -X is still a POST.
- **Idiomatic client** — the HTTP library a language community actually reaches for, rather than a literal transliteration of cURL flags.

## Questions

### Which languages can it convert to?

TypeScript, Python, Go, Java, PHP and C#.

### Does it handle headers and request bodies?

Yes. Headers, query parameters and the body are parsed out of the command and carried into the generated code, and each is listed separately so you can check it read the command correctly.

### Will the generated code run as-is?

It is intended to. Treat any credential in the command as something to move into an environment variable before committing the result.

### Is my command sent to a server?

No. Parsing and code generation both run in your browser — which matters, because cURL commands very often contain API keys and auth tokens.


## Privacy

The command is parsed in your browser and never uploaded. This is deliberate: a cURL command copied from devtools usually carries a session cookie or a bearer token, and it should not leave your machine.

## Links

- [Use the tool](https://www.postman.com/tools/curl-to-code) — the interactive version of this page.
- [Postman Tools](https://www.postman.com/tools) — every free tool in this set.
- [Import cURL docs](https://learning.postman.com/docs/getting-started/importing-and-exporting/importing-data/) — Postman documentation.
