3tej home

What is cURL to fetch / Python / Node / Go / PHP / Ruby Converter?

A cURL to fetch / Python / Node / Go / PHP / Ruby Converter converts cURL into fetch / Python / Node / Go / PHP / Ruby directly in your browser. It parses the source format, applies the standard mapping or formula, and outputs the target format ready to copy. Paste a curl command and get equivalent code.

cURL to fetch / Python / Node / Go / PHP / Ruby Converter

Paste any cURL command. Get equivalent code in JavaScript fetch, axios, Python requests, Python httpx, Node http, Go net/http, PHP curl, and Ruby net/http.

Browser-only Instant Free forever Works offline No signup
← Utilities

TLDR

Paste a cURL command from any API documentation or browser dev tools (Copy as cURL). The converter parses method, URL, headers, body, basic auth, and form data, then generates idiomatic code in 8 languages and libraries: JS fetch, JS axios, Python requests, Python httpx, Node http, Go net/http, PHP curl, and Ruby net/http. Every output is copy-paste ready.

Runs entirely in your browser. No upload, no signup, no logging. Output is for personal or commercial use; we do not claim any rights to the data you enter.

How to use this tool

  1. Enter your inputs. Each field is labeled with what it expects.
  2. Read the result instantly. Numbers update as you type or change inputs.
  3. Adjust to test sensitivity. Change one input at a time to see what moves the result most.
  4. Cross-check the formula in the section below if you want to verify the math.
  5. Copy or screenshot the result for later. The site does not save anything; close the tab and inputs are gone.

About this tool and how it works

This utility runs 100% in your browser. No data leaves your device. The underlying logic is:

Tokenize the command respecting single + double quotes and backslash-newline continuations.
For each known flag:
  -X / --request -> HTTP method
  -H / --header -> header key/value (split on first colon)
  -d / --data / --data-raw -> request body (joined with &)
  --data-urlencode -> URL-encoded form data
  -u / --user -> basic auth (base64-encoded)
  -F / --form -> multipart form field
  -b / --cookie -> Cookie header
For each output language, render the parsed model into idiomatic syntax.

You can verify by opening the browser developer tools and watching the Network tab; no requests fire during normal use beyond the initial page and library load.

Real-world scenarios where this tool helps

Convert API docs

Most APIs publish curl examples. Paste in, get JS fetch for your front end, Python for your script, Go for your service.

Reproduce a browser request

Open dev tools, right-click a request, Copy as cURL. Paste here, get fetch code you can run from a script or test.

Translate between stacks

Your team uses Python; you're prototyping in Node. Convert in one click instead of typing it out.

Teaching HTTP

Show students that fetch, requests, axios, and httpx all do the same thing under the hood. The converter makes the mapping concrete.

What this tool does

  • Tokenizes complex cURL commands with single, double, and mixed quoting.
  • Handles backslash-newline line continuations (multiline curl pastes).
  • Parses -X, --request, -H, --header, -d, --data, --data-raw, --data-urlencode, -u, --user, -F, --form, -b, --cookie, -A, -e, -G, -k.
  • Generates JS fetch, JS axios, Python requests, Python httpx, Node http, Go net/http, PHP curl, Ruby net/http.
  • Detects JSON bodies and uses idiomatic patterns (JSON.stringify, json=payload, etc.).
  • Encodes basic auth (-u user:pass) into the proper Authorization header.

What it does NOT do

  • Does not run the request - it only converts. Test the generated code in your environment.
  • Does not handle binary -d @file.bin payloads (the file path is passed through; you would need to read the file separately).
  • Does not perfectly preserve multipart form structures with nested files. Simple -F field=value works; complex multipart needs manual fixup.
  • Does not validate the URL or auth credentials. Garbage in, garbage out.
  • Does not save your command. Close the tab and the input is gone.

Common mistakes and pitfalls

  • Pasting a curl with Windows-style backslashes that aren't line continuations. The tokenizer only treats backslash-newline as continuation.
  • Forgetting that Copy as cURL from Chrome dev tools includes verbose flags (--compressed, -X with the default method). The converter handles these but the output may look noisier.
  • Expecting cookies to work cross-origin. The generated fetch code does not include credentials: 'include' by default. Add it manually if needed.
  • Pasting a curl with environment variables ($TOKEN). The tokenizer treats them as literal strings. Replace with the actual value before converting.
  • Forgetting that PHP/Ruby/Go outputs need their respective runtimes. Generated code is valid but needs PHP / Ruby / Go installed to run.

Frequently asked questions

What is cURL?

cURL is a command-line tool for making HTTP requests, available on every major OS. It's also the lingua franca of API documentation - most APIs publish examples as curl commands.

Where do I get a cURL command?

From API docs (most include curl examples), or from your browser: open dev tools (F12), Network tab, right-click any request, Copy > Copy as cURL.

Why does my converted Python code fail with 'requires authentication'?

If the original curl had a cookie or session token embedded, the converter copies it as-is. The cookie may have expired; refresh it from the browser before running.

Does it handle multipart file uploads?

Simple -F field=value works. Multipart with file references (-F file=@/path/to/file) is passed through; you need to read the file in your script separately.

Why does the body show as a string instead of a JSON object in Python?

The converter detects JSON-shaped bodies and uses json=payload (dict) in Python. If the body is not valid JSON, it falls back to data=string.

Are the generated calls async?

JS fetch and axios outputs assume top-level await (use inside an async function or modern Node). Python requests is sync; httpx output is sync. Adapt to your runtime.

Does it support GraphQL?

GraphQL over HTTP is just JSON POSTs - the converter handles them like any other API call. Paste in your curl with the query in the JSON body.

How do I add error handling?

The generated code is minimal (happy path only). Wrap fetch / requests calls in try/catch (JS) or try/except (Python) per your team's standards.

Will the converter mess up special characters in my data?

It respects single + double quotes and unescapes backslashes inside double-quoted strings. Tricky JSON with embedded quotes should be quoted with single quotes in the source curl.

Is my cURL command saved or logged?

No. The converter runs entirely in your browser. Close the tab and the command is gone.