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
-Xor--request. If absent, it defaults toPOSTwhen a body (-detc.) is present, otherwiseGET. - URL: the first non-option argument (or the value of
--url) is treated as the request target. - Headers: every
-H/--headervalue is split intoname: valuepairs. - Body: values of
-d,--data,--data-raw, and--data-binaryare 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
- In the browser network tab, copy a request via “Copy as cURL”.
- Paste it here to see which headers (auth tokens, Content-Type, etc.) and body are actually being sent.
- 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 to | Notes |
|---|---|---|
-X / --request | Method | Value used as-is (e.g. PUT, DELETE) |
-H / --header | Header | Split into name/value at the first : |
-d / --data / --data-raw / --data-binary | Body | Its presence infers a POST method |
--url | URL | More 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
-Xis given, but a-dbody exists, so it infersPOST. - URL: the first non-option argument,
https://api.example.com/v1/users. - Headers: two rows —
Authorization → Bearer abc.defandContent-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
-XPOSTwith 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
:inAuthorization: Bearer x:ystays inside the value.