cURL Parser
Parse cURL commands into structured components. Extract URL, method, headers, body, auth, and generate JavaScript fetch() and axios equivalents.
Invalid cURL
How to Use cURL Parser
Paste cURL Command
Copy a cURL command from browser DevTools (right-click a request and "Copy as cURL") and paste it into the input area.
Parse Components
The command is broken down into URL, method, headers, body, auth, and cookies automatically.
Get Code
Copy the generated fetch() or axios code for use in your JavaScript projects.
What is cURL?
cURL (Client URL) is a command-line tool and library for transferring data using various protocols. It is widely used for testing APIs, debugging HTTP requests, and automating data transfers. Browser developer tools can export network requests as cURL commands, making it easy to share and reproduce HTTP requests.
Command-Line Tool
cURL is a command-line tool for transferring data using various protocols including HTTP, HTTPS, FTP, and more.
Browser DevTools Export
Most browser DevTools let you right-click a network request and "Copy as cURL" to get the exact command.
Code Conversion
Convert cURL commands to JavaScript fetch() or axios code for easy integration into your web applications.
Frequently Asked Questions
Yes. The tool converts cURL commands to JavaScript fetch() and axios code snippets. The generated code preserves the URL, method, headers, and body from the original cURL command.
Yes. It parses -d/--data, --data-raw, and --data-binary flags including JSON payloads. JSON body data is automatically formatted with proper indentation in the generated code.
Common flags including -X (method), -H (headers), -d (data), -b (cookies), -u (auth), -k (insecure), -L (follow redirects), --compressed, and more. Complex or unusual flags may not be fully parsed.
The tool maps flags to PHP's curl API: the URL goes into CURLOPT_URL, each -H into CURLOPT_HTTPHEADER, -d into CURLOPT_POSTFIELDS, and -u into CURLOPT_USERPWD. Paste the command, copy the generated snippet, and the boilerplate (RETURNTRANSFER, error handling) is generated for you.
-H 'Content-Type: application/json' adds one header; repeat -H for each additional header and they all send. -H can also remove a header by naming it with no value (-H 'User-Agent:') or send an empty value with a trailing semicolon. Multiple -H flags preserve order, which matters for a few APIs.
HTTP Basic is -u user:password (curl base64-encodes it into an Authorization header). Bearer tokens go as a header: -H 'Authorization: Bearer <token>'. API keys appear either as headers or as query parameters depending on the service. Warning: secrets on the command line land in shell history - prefer a netrc file or environment variable.
-d sends data as application/x-www-form-urlencoded and strips newlines; --data-binary sends the payload verbatim, which JSON APIs need; -F builds a multipart/form-data request, the only option for file uploads. GET-style parameters use -G combined with -d, which moves the data into the URL query string.
Usually quoting: the shell strips quotes before curl sees them, but the target language re-interprets them - single quotes that are safe in the shell need different handling in JavaScript. Other traps: line-ending backslashes from multiline commands, percent signs in URLs breaking %-formatting in some languages, and cookie files referenced by -b/-c that don't exist in the new environment.
Related Tools
Authoritative References
Primary sources behind this tool - official standards and specifications, not secondhand summaries.
cURL - Documentation
The official cURL documentation: every flag explained by the tool authors.
Everything curl - The Official Book
Everything curl — the official book on the command line and its protocol engines.
CURL - Wikipedia
cURL history and the libcurl engine behind countless language HTTP clients.