cURL Parser

Parse cURL commands into structured components. Extract URL, method, headers, body, auth, and generate JavaScript fetch() and axios equivalents.

Parse Components Generate fetch() Generate axios

How to Use cURL Parser

1

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.

2

Parse Components

The command is broken down into URL, method, headers, body, auth, and cookies automatically.

3

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

Can it generate fetch() code from cURL?

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.

Does it handle POST data and file uploads?

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.

What cURL flags are supported?

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.

How do I convert a cURL command into PHP code?

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.

What does the -H flag do and how are repeated headers handled?

-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.

How is authentication passed in cURL?

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.

What is the difference between -d, --data-binary, and -F?

-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.

Why does converted code fail when the cURL command worked?

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.

Will the tool remember my input if I refresh or close the tab?

Yes. Whatever you paste or type is kept as a draft in your browser's local storage, and the page restores it — with the results already re-parsed — the next time you open the tool. Clearing the input erases the draft. The data never leaves your device: no account, no upload, no server-side copy. Keys and secrets you enter for verification are never saved.

Parse and analyze network-related data like HTTP headers, cURL commands, IP addresses, and user agents