OneWebDesk

cURL Command Parser

Break a cURL command into method, URL, headers and body.

A curl command copied from dev tools, API docs, or a teammate crams the method, URL, headers, and body onto one line, which is hard to read at a glance. This cURL command parser splits the pasted command with a quote-aware tokenizer and lays out the HTTP method, request URL, header list, and request body in clean tables.

You can paste long commands from “Copy as cURL” in Chrome/Firefox dev tools, including commands spread across multiple lines with a trailing backslash (\). All parsing happens entirely in your browser, and the command you paste is never sent anywhere.

What it extracts

The parser recognizes and separates four parts of the pasted cURL command.

  • Method: taken from -X or --request. If absent, it defaults to POST when a body (-d etc.) is present, otherwise GET.
  • URL: the first non-option argument (or the value of --url) is treated as the request target.
  • Headers: every -H / --header value is split into name: value pairs.
  • Body: values of -d, --data, --data-raw, and --data-binary are collected as the request body.

Quotes and line breaks

The tokenizer groups single- and double-quoted values into a single token and keeps spaces inside quotes intact. A trailing backslash is treated as a line continuation and joined with the next line, so commands that were formatted across several shell lines can be pasted as-is.

Typical workflow

  1. In the browser network tab, copy a request via “Copy as cURL”.
  2. Paste it here to see which headers (auth tokens, Content-Type, etc.) and body are actually being sent.
  3. Verify the intended method and headers, or quickly grasp the structure when moving it into docs or an issue.

Going the other way, when you want to build a new request from scratch, the cURL command builder lets you enter the method, headers and body and assembles a ready-to-run command.

Recognized options and their short/long forms

cURL exposes most features through both a short and a long flag. Here is how this parser maps them.

Option (short / long)Maps toNotes
-X / --requestMethodValue used as-is (e.g. PUT, DELETE)
-H / --headerHeaderSplit into name/value at the first :
-d / --data / --data-raw / --data-binaryBodyIts presence infers a POST method
--urlURLMore explicit than the first non-option argument
--compressed / -L / -k / -s(ignored)Transport flags with no effect on method/headers/body

A worked example, step by step

Suppose you paste this command.

curl https://api.example.com/v1/users -H 'Authorization: Bearer abc.def' -H 'Content-Type: application/json' -d '{"name":"Lee"}'

The parser reads it as follows.

  • Method: no -X is given, but a -d body exists, so it infers POST.
  • URL: the first non-option argument, https://api.example.com/v1/users.
  • Headers: two rows — Authorization → Bearer abc.def and Content-Type → application/json.
  • Body: {"name":"Lee"}, with the spaces and braces inside the single quotes preserved as one token.

Common pitfall

  • Windows vs. shell quoting: commands copied on Windows cmd often wrap headers in double quotes ("), while Linux/macOS use single quotes ('). Mixing both styles in one command can leave a quote unbalanced and break tokenization — paste a single, consistent style.
  • Glued options: a form like -XPOST with the flag stuck to its value is safer rewritten as -X POST.
  • Colons in values: headers split only at the first colon, so the trailing : in Authorization: Bearer x:y stays inside the value.

Frequently asked questions

Is the command I paste sent to a server?
No. All parsing runs purely in your browser's JavaScript, and the cURL command—including its tokens, headers, and body—is never transmitted to any server.
How is the method determined?
It uses the value given by -X or --request. If neither is present, it infers POST when a -d/--data-style body option exists, and GET otherwise.
Do multi-line commands work?
Yes. A trailing backslash (\) is treated as a line continuation and joined automatically, so the multi-line commands emitted by dev tools can be pasted directly.
What about options it doesn't support?
It only interprets the options needed to extract the method, URL, headers, and body. Other flags such as --compressed, -L, or --insecure are ignored while the rest is parsed.
What if the command doesn't start with curl?
If the command does not begin with curl (or curl.exe), it is treated as not a valid cURL command and flagged with a danger state. Paste starting from the curl part.

Related tools

HTTP / API