# cURL to Code Converter

> Free curl converter: paste a curl command, get JavaScript fetch, Axios, Python requests, Go, PHP or raw HTTP. Private — it runs in your browser.

- URL: https://tools.crawlink.com/curl-to-code
- Category: Developer Tools
- Price: Free, no account, no usage limits
- Privacy: Runs entirely in your browser and works offline. Nothing you enter or upload leaves your device.

## What it does

Paste a curl command (for example from your browser's "Copy as cURL", Postman or an API reference) and this tool rewrites it as JavaScript fetch, Axios, Python requests, Go net/http or PHP cURL code, or as the raw HTTP request it sends. It understands quoting and line continuations, headers, every -d variant, --json, -F multipart uploads, basic auth, cookies, -G query strings and -k. Conversion happens in your browser, so tokens and cookies in the command never leave your device.

## Features

- Handles single, double and ANSI-C quoting and backslash line breaks
- -H, -d, --data-raw, --data-urlencode, --json, -F, -u, -b, -A, -G, -I, -k, -L
- JSON bodies become real objects (json= in Python, JSON.stringify in fetch)
- Multipart file uploads for every language
- Raw HTTP view of the request
- Secrets stay in your browser

## How to use

1. Paste a curl command into the left box (multi-line commands with \ are fine).
2. Pick the target: fetch, Axios, Python, Go, PHP or raw HTTP.
3. Check the parsed method, URL and headers, plus any notes about flags that need attention.
4. Copy the generated code or download it as a file.

## FAQ

### How do I copy a request as curl from Chrome?

Open DevTools (F12), go to the Network tab, right-click the request and choose Copy > Copy as cURL (bash). On Windows pick the bash version rather than cmd for the cleanest result, then paste it here.

### What is the difference between -d, --data-raw and --data-binary?

-d sends the data as a form body and strips newlines; it also treats a leading @ as a file name. --data-raw is the same but never reads files, and --data-binary keeps newlines exactly. All of them make curl use POST with Content-Type application/x-www-form-urlencoded unless you set another type.

### Why does the Python code use json= instead of data=?

When the body is JSON (from --json or a Content-Type: application/json header) the converter turns it into a Python dictionary and passes json=, which serialises it and sets the header for you. Other bodies are sent as a string with data=.

### What does -k (--insecure) do?

It tells curl to skip TLS certificate checks. The converter carries it over (verify=False in Python, InsecureSkipVerify in Go, CURLOPT_SSL_VERIFYPEER in PHP), but you should only use it for local testing, never in production.

### Is it safe to paste commands with API keys or cookies?

Yes, here. The parser runs in your browser and works offline; nothing is uploaded or logged. Still, treat the generated code as sensitive and remove secrets before sharing it.

Also searched as: curl to python, curl to fetch, curl converter, curl to code, curl to axios, curl to go, curl to php, convert curl command.

## Related tools

- [JSON Formatter](https://tools.crawlink.com/json-formatter): Format, validate and minify JSON
- [JSON to Code](https://tools.crawlink.com/json-to-code): Generate TypeScript, Zod, Go, Python or SQL from JSON
- [URL Encoder / Decoder](https://tools.crawlink.com/url-encoding-decoding): Encode and decode URL components
- [JWT Decoder](https://tools.crawlink.com/jwt-decoder): Decode and inspect JSON Web Tokens safely offline
- [Base64 Encoder](https://tools.crawlink.com/base64-encoding): Encode text, images and files to Base64

---
Part of Tools by Crawlink — https://tools.crawlink.com/ · All tools: https://tools.crawlink.com/llms.txt
