Network

cURL Converter

Paste a cURL command and read it back as working code in fetch, axios, Python requests, Go, Rust, PHP, Java, and around thirty other clients and languages. The method, full URL with query string, headers, cookies, basic auth, and the request body — JSON, form, or raw — are carried straight across, then rendered with per-language syntax highlighting and a one-click copy. The conversion engine loads on demand with a progress bar, and once it is ready everything runs in the browser: the command and any tokens it carries never leave this page.

  • Convert one cURL command to fetch, axios, Python, Go, Rust, PHP, Java, and 30+ targets
  • Method, URL, query string, headers, cookies, basic auth, and body all survive the round trip
  • Per-language syntax highlighting with one-click copy straight into your editor
  • Engine loads on demand, then runs fully in-browser — commands and tokens stay on this page
tools/cURL Converter
8%
Loading the conversion engine
8%
The cURL parser is a one-time download and is cached for the rest of your visit.
Samples

Overview

Paste a cURL command copied from DevTools, an API doc, or a teammate, and read it back as code in the language your project actually uses — without retyping a single header.

  1. 01

    One command, thirty-plus targets

    Browser fetch, jQuery $.ajax, and XHR; Node fetch, axios, got, and ky; Python requests and http.client; Go, Rust, C#, Swift, Dart, and Objective-C; PHP cURL and Guzzle; Java OkHttp and Kotlin; plus Ruby, Elixir, R, MATLAB, Perl, Lua, PowerShell, and Ansible — each ready to paste.

  2. 02

    The whole request comes across

    Method (-X), the full URL with its query string, every -H header, cookies from -b or a Cookie header, basic auth from -u, and the body from --data, --data-raw, --data-urlencode, or -F form fields are all reconstructed in the target client.

  3. 03

    Bodies keep their shape

    A JSON --data-raw payload lands as a real object literal or JSON.stringify call, form fields become the target language’s form encoding, and raw text stays raw — instead of a flattened string you have to re-parse by hand.

  4. 04

    Highlighted, copy-ready output

    Each target renders with syntax highlighting tuned to its own language and follows your light or dark theme, with a one-click copy button so the snippet drops straight into your editor.

  5. 05

    Switch stacks without re-pasting

    Paste once, then flip the target between fetch, Python, and Go from the dropdown to compare how the same request reads in each ecosystem before you commit to one.

  6. 06

    On-demand engine, in-browser conversion

    The cURL parser is a sizeable bundle, so it loads on demand behind a progress bar and is cached for the rest of your visit. After that, parsing and code generation happen on this page — no request carries your command, headers, or tokens off the browser.

How to use

One input box, one dropdown — paste, pick, copy. The conversion engine loads itself the first time you open the page.

  1. 01

    Copy a cURL command: in Chrome DevTools right-click a request and choose Copy → Copy as cURL, or grab one from an API doc or a teammate.

  2. 02

    Paste it into the cURL input on the left. Multi-line commands with backslash line continuations are fine.

  3. 03

    Pick the target language or client from the dropdown at the bottom of the tool.

  4. 04

    Read the highlighted result on the right, then use the Copy button at the top to drop it into your editor.

  5. 05

    Switch targets from the dropdown to compare the same request across stacks — no need to paste again.

Details

Turning a one-off cURL command into real project code stops being a manual rewrite, and stops introducing the typos a rewrite usually brings.

  • Recovers method, URL, query parameters, headers, cookies, basic auth, and body straight from the cURL flags.
  • Handles multi-line commands with backslash continuations, plus single-quoted, double-quoted, and $'…' shell strings.
  • JSON request bodies survive the round trip and land formatted in the target snippet, not as an opaque string.
  • Targets span browser (fetch, jQuery, XHR), Node (fetch, axios, got, ky), and more than twenty other languages and clients.
  • Output uses per-language syntax highlighting that tracks your light or dark theme for readable diffs and screenshots.
  • Selecting a new target re-renders instantly from the already-parsed command, with no extra round trip.
  • The parser bundle loads on demand behind a progress bar and is cached, so the page stays light until you actually need it.

Use cases

The everyday "I have a cURL, I need code" moments — each one stops being a hand rewrite and a source of subtle copy mistakes.

  1. Move a DevTools request into code

    Copy as cURL from the Network panel, convert to fetch or axios, and paste it straight into the frontend you are building, headers and body intact.

  2. Turn API docs into a working call

    Most APIs document examples in cURL. Convert to Python requests or Go and start from a call that already matches the documented headers and payload.

  3. Port a request between stacks

    A backend example is in PHP cURL but your service is in Rust or Java — convert once and keep method, auth, headers, and body identical instead of translating by eye.

  4. Bootstrap a regression fixture

    Convert a captured request into Python or Node to seed an integration test, then swap in test credentials and add assertions around the response.

  5. Compare client libraries before committing

    Flip the same request between fetch, got, and ky, or between requests and http.client, to see which API shape reads best for your team and house style.

  6. Hand off a runnable snippet

    Give teammates a ready-to-run fetch or PowerShell snippet instead of a raw cURL they have to translate themselves — fewer "how do I send this in X?" questions.

See also

When you need to read a request apart instead of converting it, open HTTP Message Parser to unpack raw HTTP, cURL, or fetch into a structured view of headers, cookies, and body. For tangled query strings or redirect chains in the URL, URL Tools walks each component apart and clears tracking parameters. When an Authorization header or cookie carries a JWT, JWT Inspector decodes the payload and verifies the signature so you do not act on an unverified token.

Best practices

The conversion is faithful to the command, but the snippet still ships into your project — give it a quick pass before it lands.

  • Prefer the multi-line cURL from DevTools "Copy as cURL" so every -H header and flag survives the paste cleanly.
  • Strip or replace Authorization headers, session cookies, and API tokens before sharing or committing the converted code.
  • Move secrets into environment variables or a config loader in the generated snippet rather than leaving them inline.
  • Add timeouts, retries, and error handling to fit your project — the output reproduces the request, not the production hardening around it.
  • Replace example domains and placeholder IDs with real configuration before the snippet reaches a live codebase.
  • Treat a request body referencing a local file (--data @payload.json) as a placeholder; wire up real file reading in the target language.
  • Do not leave production tokens sitting in any online tool, including this one. Clear the input when you are finished.

Limitations

Knowing the edges keeps you from reaching for this as an HTTP client or a debugger.

  • No request is sent — the tool only translates the command text, so it cannot run the call, follow redirects, or show a response.
  • Very exotic or shell-expanded flags (process substitution, piped --data, globbed uploads) may not map cleanly to every target language.
  • Generated code is a faithful starting point, not production-ready; auth refresh, pagination, retries, and error handling are still yours to add.
  • Binary uploads referenced by file path (for example, --data @file or -F file=@photo.png) cannot be inlined, since the file is not available here.
  • Only cURL is accepted as input. To parse raw HTTP messages and fetch snippets, or to inspect headers and cookies in a structured view, use the HTTP Message Parser.

FAQ

Common questions cover supported targets, what is preserved, the on-demand engine, accuracy, and where the data lives.

Which languages and clients can I convert to?

Around thirty targets, including browser fetch, jQuery, and XHR; Node fetch, axios, got, and ky; Python requests and http.client; Go, Rust, C#, Swift, Dart, and Objective-C; PHP cURL and Guzzle; Java OkHttp and Kotlin; plus Ruby, Elixir, R, MATLAB, Perl, Lua, PowerShell, and Ansible.

What parts of the request are preserved?

Method, the full URL with its query string, headers, cookies, basic auth, and the request body — JSON, form-urlencoded, or raw — are all carried across to the selected target. Multipart form fields from -F are mapped where the target client supports them.

Why is there a loading bar when the page opens?

The cURL parser is a sizeable bundle, so it is downloaded on demand behind a progress bar instead of being shipped with the rest of the page. It is cached for the rest of your visit, so subsequent conversions are instant.

Can I run the generated code as-is?

It is a faithful starting point that preserves the request. Before shipping, add error handling, timeouts, and environment variables, and move any secrets out of the inline code.

How is this different from the HTTP Message Parser?

This tool is focused on one job: cURL in, code out. The HTTP Message Parser also accepts raw HTTP messages and fetch snippets and breaks a request into a structured view of headers, cookies, and body. Use this one when you just need the code, and that one when you need to inspect or debug a message.

Does my cURL command get uploaded?

No. Once the engine has loaded, parsing and code generation both run in the browser. No network request carries your command, headers, or tokens off this page.

Why does my command fail to convert?

The input must be a complete cURL command starting with curl. Heavily shell-expanded commands, or flags that have no equivalent in the chosen target, may not convert — try a different target, simplify the command, or remove shell-only constructs.

Related tools

Keep going on network and request work — inspect a full HTTP message, clean a URL, or decode the JWT from an Authorization header.