DT Dev Tools

cURL to Code

Convert curl commands to JavaScript fetch, Node.js axios, Python requests, Go, PHP and C# HttpClient β€” or turn a DevTools fetch() back into curl. Runs locally.

πŸ”’ Runs entirely in your browser β€” nothing is uploaded

Was this tool useful? Rate it:

What cURL to Code does

cURL to Code parses a curl command and rewrites it as runnable code for seven targets: browser or Node.js fetch, Node.js axios, Python requests, Go net/http, PHP's cURL extension, C# HttpClient, and a normalised curl command. It tokenizes the command the way a shell would, respecting single and double quotes and line continuations, then extracts the request method, target URL, headers, and body. The method defaults to GET, switches to POST automatically when a body is present, and honors an explicit -X, --request or --head flag. Basic authentication supplied with -u becomes an Authorization header, and --json sets the JSON content type for you.

It also works in the other direction. Chrome, Edge and Firefox can copy any network request as fetch(…); paste that snippet and the tool reads the URL, method, headers and body, so you can turn it into curl for a terminal or into Go or C# for a backend service. In the axios output, JSON bodies become real JavaScript objects, and in the C# output the Content-Type header is moved to the request content where HttpClient expects it.

Private browser-based workflow

All tokenizing and code generation happen inside your browser with client-side JavaScript. The tool does not upload your curl command, URLs, headers, tokens, or request bodies to a server, and it does not require an account. That local-only model matters because a copied curl command frequently contains authorization headers, cookies, and API keys captured from a real session. Keeping the conversion on your machine means those secrets never leave the page, and the snippets appear instantly without a network round trip.

Practical tips

For the cleanest results, paste a single curl command rather than a chained shell pipeline, and keep line continuations intact so flags are not merged. Remove or rotate any credentials that were embedded in a copied command before sharing the generated code, and confirm that the target URL is the environment you intend to call. The fetch and Python snippets send the body exactly as curl would; switch Python to the json= argument when you want requests to serialize an object for you. Always treat generated clients as a draft and add error handling, timeouts, and retries appropriate to your application before using them in production.

How to use

  1. Paste curl or fetchPaste a curl command or a DevTools "Copy as fetch" snippet.
  2. Choose a languagePick fetch, axios, Python, Go, PHP, C# or curl; the code updates as you type.
  3. Copy the codeCopy the snippet into your project and add error handling.

Frequently asked questions

Which languages can it generate?
JavaScript fetch, Node.js axios, Python requests, Go net/http, PHP cURL, C# HttpClient, and a clean curl command.
Which curl options are supported?
The URL, -X/--request, -H/--header, -d/--data variants, --data-urlencode, --json, -u/--user, -A, -e, -b, -I/--head and common flags such as -L, -k, -s and --compressed. Unknown flags are skipped.
Can I convert a fetch() call back to curl?
Yes. Paste a snippet from your browser's DevTools "Copy as fetch" and choose cURL (or any other language) as the output.
Is my command uploaded?
No. Parsing and code generation run entirely in your browser.