# cURL to Code

> Turn cURL into fetch, axios, Python, Go or PHP. Runs entirely in your browser — nothing is uploaded.

Source: https://toffeekit.com/tools/curl-to-code

**Category:** [Developer](https://toffeekit.com/category/developer) · **Price:** Free · **Runs:** in your browser, nothing is uploaded

Open the tool: https://toffeekit.com/tools/curl-to-code

**Also useful for:** curl, fetch, axios, python requests, golang, php, http, api, convert

## How it works

1. Paste your cURL command into the cURL command box, for example from your browser's Copy as cURL.
2. Pick a Language: JS fetch, Node axios, Python, Go or PHP.
3. Read the generated request code and any notes about flags that could not be converted.
4. Click Copy or Save to download the file, such as request.py or main.go.

## FAQ

### How do I convert a cURL command to fetch?

Paste the command and choose JS fetch. You get a fetch call with the method, URL, headers and body filled in.

### How do I get a cURL command from my browser?

Open the Network tab in developer tools, right-click a request and choose Copy as cURL. Paste that straight into this tool.

### Which cURL options are supported?

Common ones: -X, -H, -d and --data-raw, --data-urlencode, --json, -F for forms, -u, -b, -L, -k, --compressed and --max-time. Unsupported flags are ignored.

### Does it convert JSON bodies properly?

Yes. When the body is JSON, the generated code builds it as an object or serializes it correctly instead of leaving a raw string.

### What about a file sent with -d @file.json?

The file cannot be read in the browser, so the code uses a placeholder and a note tells you to paste the contents in its place.

### Is cURL to Code free and private?

Yes. It's free with no sign-up or limits, and it runs entirely in your browser, so what you type or paste never leaves your device. It works on phones and computers alike.

## Privacy

cURL to Code runs entirely in your browser. Your files and text are processed on your device and are never uploaded.

## Related tools

- [JSON Formatter](https://toffeekit.com/tools/json-formatter) — Format, minify and validate JSON with clear errors.
- [Base64 Encode / Decode](https://toffeekit.com/tools/base64-encoder) — Encode text to Base64 or decode it back, UTF-8 safe.
- [URL Encode / Decode](https://toffeekit.com/tools/url-encoder) — Percent-encode query values or whole URLs.
- [HTML Entities](https://toffeekit.com/tools/html-entity-encoder) — Escape < > & and quotes, or decode entities.
- [JWT Decoder](https://toffeekit.com/tools/jwt-decoder) — Read a token's header, claims and expiry.
- [Hash Generator](https://toffeekit.com/tools/hash-generator) — MD5, SHA-1, SHA-256, SHA-384 and SHA-512 at once.

