How to Copy a Request as cURL in Chrome — DevTools Guide
Chrome DevTools has a built-in feature most developers discover by accident: right-clicking any network request and copying it as a cURL command. This converts a full browser request — headers, cookies, body, auth tokens and all — into a single terminal command you can replay, share, or pipe into scripts. Here is exactly where to find it and how to use it.
F12
Open DevTools in any browser
1 right-click
Copy any request as cURL
HAR export
Get cURL for ALL requests at once
Where Is 'Copy as cURL' in Chrome DevTools?
The option is buried one level deep in the Network tab context menu — easy to miss the first time. Here is exactly where to find it:
Open Chrome DevTools
Press F12 (Windows/Linux) or Cmd+Option+I (Mac). You can also right-click anywhere on the page and select Inspect.
Go to the Network tab
Click the Network tab at the top of the DevTools panel. If no requests are listed, refresh the page while DevTools is open to capture them.
Find the request you want
Click on any request in the list. You can filter by type (XHR/Fetch for API calls, Doc for page loads) or use the search bar to find a specific URL.
Right-click the request
Right-click on the request row in the left panel. A context menu appears with several options.
Click Copy → Copy as cURL
Hover over "Copy" in the context menu to expand the submenu. Select "Copy as cURL (bash)" for Linux/Mac or "Copy as cURL (cmd)" for Windows Command Prompt.
Cross-browser support
Copy as cURL also works in Firefox (right-click → Copy Value → Copy as cURL), Edge (identical to Chrome), and Safari (right-click → Copy as cURL). The menu label and submenu structure differ slightly but the feature is present in all major browsers.
Step-by-Step: Understanding the Copied cURL Command
When you copy a request as cURL, Chrome generates a complete command that replicates the exact request your browser sent — including all authentication headers, cookies, and request body. Here is an example of what a copied API request looks like:
curl 'https://api.example.com/v2/users/me' -H 'authority: api.example.com' -H 'accept: application/json, text/plain, */*' -H 'accept-language: en-US,en;q=0.9' -H 'authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...' -H 'content-type: application/json' -H 'origin: https://app.example.com' -H 'referer: https://app.example.com/dashboard' -H 'sec-ch-ua: "Chromium";v="124", "Google Chrome";v="124"' -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "macOS"' -H 'sec-fetch-dest: empty' -H 'sec-fetch-mode: cors' -H 'sec-fetch-site: cross-site' -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)...' --cookie 'session_id=abc123; csrf_token=xyz789' --compressedHere is what each flag means:
-H flag
Sets a request header. Every browser header is included — Accept, Authorization, Content-Type, User-Agent, and all the Sec-* security headers Chrome sends automatically.
--cookie flag
Sends the session cookies your browser had at the time of the request. This is what makes the copied cURL authenticated — the same session token is included.
-d or --data flag
Included for POST/PUT/PATCH requests. Contains the exact request body — JSON payload, form data, or whatever was sent.
--compressed flag
Tells cURL to accept and decompress gzip/deflate responses, matching what the browser does. Without it, you might get garbled binary output.
Your session tokens are included
'Copy as cURL' Not Working — Common Fixes
Sometimes the Copy as cURL option is missing, greyed out, or produces a command that fails when you run it. Here are the most common reasons and how to fix them:
Request was not captured
If you opened DevTools after the request already happened, it will not appear in the Network tab. Open DevTools before navigating or performing the action, then repeat it.
Wrong Network tab filter
The Network tab may be filtered to show only certain request types (e.g. XHR). Make sure the filter is set to "All" so all request types are visible.
Preflight CORS request selected
When CORS is involved, the browser sends a preflight OPTIONS request before the actual request. Make sure you are right-clicking the actual request (GET/POST/etc.), not the OPTIONS preflight.
Streaming or WebSocket request
Server-Sent Events and WebSocket connections cannot be exported as cURL because they are persistent connections, not discrete HTTP requests. For those, you need to capture and replay individual messages.
Capturing all requests at once
How to Export ALL Requests as cURL (HAR File Method)
The Copy as cURL feature works great for a single request. But if you need cURL commands for every request in a session — for debugging, API documentation, or test automation — copying them one by one is tedious. The HAR file method gives you cURL for every single request at once.
A HAR (HTTP Archive) file is a JSON export of all network requests Chrome captured during a session — including URLs, headers, cookies, request bodies, and response data. The HAR to cURL converter at UnblockDevs reads the HAR and outputs a cURL command for each request.
Open DevTools and go to the Network tab
Press F12 and click the Network tab. Refresh the page or perform the actions you want to capture. Make sure recording is active (the red circle should be solid, not hollow).
Save all as HAR
Right-click anywhere in the Network request list and choose "Save all as HAR with content". This downloads a .har file containing every captured request.
Open the HAR to cURL converter
Go to unblockdevs.com/har-to-curl and upload your .har file. The tool parses the file client-side — your network data stays in your browser.
Browse and copy cURL commands
Every request from your session appears as a separate cURL command. Filter by URL, method, or status code to find the ones you need. Copy individual commands or export all at once.
Convert a full HAR file to cURL commands
How to Simplify or Convert cURL Commands
The cURL command copied from Chrome DevTools is exhaustive — it includes every browser header Chrome sent, including many you do not need when making the same API call from code. The command often has 15–20 -H flags for headers like sec-ch-ua and sec-fetch-dest that the API server ignores entirely.
The cURL Converter at UnblockDevs simplifies this in two ways: it strips unnecessary browser-specific headers and converts the cURL command to your language of choice — Python requests, JavaScript fetch, Node.js axios, and more.
# Chrome DevTools output (verbose, 18 headers)
curl 'https://api.example.com/orders' -H 'authorization: Bearer TOKEN' -H 'content-type: application/json' -H 'accept: application/json' -H 'sec-ch-ua: "Chromium";v="124"' -H 'sec-ch-ua-mobile: ?0' -H 'sec-fetch-dest: empty' # ... 12 more browser headers
# Simplified cURL (only what the API needs)
curl 'https://api.example.com/orders' -H 'Authorization: Bearer TOKEN' -H 'Content-Type: application/json' -H 'Accept: application/json'Verbose cURL vs. clean API call
Raw DevTools output — bloated with browser headers
curl 'https://api.example.com/data' -H 'authority: api.example.com' -H 'accept: */*' -H 'accept-language: en-US,en;q=0.9' -H 'authorization: Bearer TOKEN' -H 'sec-ch-ua: "Chromium"' -H 'sec-ch-ua-mobile: ?0' -H 'sec-fetch-dest: empty' -H 'sec-fetch-mode: cors' --compressedCleaned up — only the headers the API actually needs
curl 'https://api.example.com/data' -H 'Authorization: Bearer TOKEN' -H 'Accept: application/json'Converter tool
Convert cURL commands to Python, JavaScript, Go, PHP, and more at unblockdevs.com/curl-converter. Paste the cURL, pick a language, get working code instantly.