How to Get cURL from Chrome — Copy Any Request as cURL Command
Chrome's DevTools lets you copy any network request as a cURL command in seconds. This is one of the most useful developer tricks — instantly get the exact API call your browser makes, complete with all headers, cookies, authentication tokens, and request body. Once you have the cURL, you can replay it in your terminal, convert it to Python or JavaScript, or use it to debug API issues without reverse-engineering anything.
3 clicks
to copy any request as cURL from Chrome DevTools
All headers
cookies, auth tokens, content-type all included
Any browser
works in Chrome, Firefox, Edge, and Safari
Replay
paste in terminal to reproduce the exact request
Copy as cURL in Chrome — Step by Step
Open Chrome DevTools
Press F12 (Windows/Linux) or Cmd+Option+I (Mac) to open DevTools. Alternatively, right-click anywhere on the page and select "Inspect." Navigate to the "Network" tab in DevTools.
Trigger the request you want to capture
With the Network tab open, perform the action on the page that triggers the request: click a button, submit a form, load new content, or navigate to a page. The request will appear in the Network panel as it happens.
Find the request in the Network list
Look for the request in the list. Use the filter bar to narrow results: click "XHR" or "Fetch" to show only API calls, or type part of the URL in the filter input to find it quickly. Click the request to see its details.
Right-click the request
Right-click the request row in the Network list (not in the detail panel). A context menu appears with Copy options.
Select Copy → Copy as cURL (bash)
Hover over "Copy" in the context menu, then select "Copy as cURL (bash)" from the submenu. On Windows, you may also see "Copy as cURL (cmd)" which uses Windows-compatible syntax.
Paste in your terminal
Open your terminal application and paste with Cmd+V (Mac) or Ctrl+Shift+V (Linux). Press Enter to execute the request. The API call is replayed with all the original headers and body.
What Gets Copied — Understanding the Output
# A simple GET request Chrome copies:
curl 'https://api.example.com/users/123' \
-H 'accept: application/json, text/plain, */*' \
-H 'accept-language: en-US,en;q=0.9' \
-H 'authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...' \
-H 'content-type: application/json' \
-H 'cookie: session=abc123; _csrf=xyz789' \
-H 'sec-ch-ua: "Chromium";v="130"' \
-H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)...' \
--compressed
# A POST request with JSON body:
curl 'https://api.example.com/users' \
-X POST \
-H 'authorization: Bearer eyJ...' \
-H 'content-type: application/json' \
-H 'cookie: session=abc123' \
--data-raw '{"name":"Alice","email":"alice@example.com"}' \
--compressedAuthorization headers
Chrome includes your live Bearer token or API key in the copied cURL. This is what makes the request work — it carries your authenticated session. This is also why you must never share this cURL publicly.
Cookies
Session cookies that authenticate your browser session are included. The server uses these to identify who is making the request. Copying the cURL effectively clones your browser session.
Browser-specific headers
Headers like sec-ch-ua, sec-fetch-*, and accept-encoding are browser-specific and usually not needed when replaying from terminal. You can safely remove these without affecting the API call.
--compressed flag
The --compressed flag tells curl to accept and decompress gzip/brotli responses, matching what Chrome does automatically. Keep this flag — without it, you may receive binary-encoded response data.
Copy as cURL in Firefox, Edge, and Safari
Firefox
Open DevTools with F12 → Network tab → trigger the request → right-click the request in the list → Copy Value → "Copy as cURL". Firefox also offers "Copy as cURL (POSIX)" which uses single quotes compatible with Linux and Mac terminals.
Microsoft Edge
Edge uses the same Chromium DevTools as Chrome. F12 → Network tab → right-click request → Copy → "Copy as cURL (bash)". The output format is identical to Chrome.
Safari
First enable Developer Tools: Safari menu → Settings → Advanced → check "Show features for web developers." Then: Develop menu → Show Web Inspector → Network tab → right-click request → Copy as cURL.
Postman Interceptor
Postman offers a Chrome extension called Interceptor that captures browser requests directly into Postman collections as you browse. This is an alternative to copying cURL manually — useful if you regularly work with browser API traffic.
Copied cURL contains your authentication tokens
Cleaning Up and Converting the cURL
The raw cURL from Chrome often has many browser-specific headers that aren't needed for API testing. Here's how to clean it up for practical use and how to convert it to other languages.
# Remove these browser-only headers (safe to delete):
# sec-ch-ua, sec-ch-ua-mobile, sec-ch-ua-platform
# sec-fetch-dest, sec-fetch-mode, sec-fetch-site
# accept-language (usually)
# user-agent (unless the API checks it)
# Minimal API request — keep only what matters:
curl 'https://api.example.com/users/123' \
-H 'authorization: Bearer eyJhbGciOi...' \
-H 'content-type: application/json' \
-H 'cookie: session=abc123'
# POST with minimal headers:
curl 'https://api.example.com/users' \
-X POST \
-H 'authorization: Bearer eyJhbGciOi...' \
-H 'content-type: application/json' \
-d '{"name":"Alice","email":"alice@example.com"}'# Using curlconverter (npm package):
npx curlconverter --language python 'curl https://api.example.com/users \
-H "Authorization: Bearer token" \
-H "Content-Type: application/json" \
-d "{"name": "Alice"}"'
# Output:
import requests
headers = {
'Authorization': 'Bearer token',
'Content-Type': 'application/json',
}
json_data = {
'name': 'Alice',
}
response = requests.post('https://api.example.com/users',
headers=headers, json=json_data)
# Also available at curlconverter.com for browser-based conversionPractical Use Cases for Copy as cURL
Debug API responses
If a web app shows an error, capture the failing API request as cURL and run it in your terminal. Add -v for verbose output to see all request/response headers, or pipe to jq for formatted JSON output.
Automate web workflows
If a website doesn't have an official API but you need to automate an action, capturing the request as cURL gives you the exact parameters to replicate programmatically. Works for form submissions, data downloads, and more.
Test without re-logging in
When a request requires complex authentication that's hard to reproduce in code, copying the cURL from your logged-in browser session lets you test with real credentials immediately.
Share reproducible bug reports
When filing API bug reports, a cURL command (with sensitive data redacted) is far more useful than a screenshot. It gives developers an exact reproduction step.
Capture requests that happen on page load
Some API requests happen immediately when a page loads, before you can interact with DevTools. To capture them: open DevTools first (F12), navigate to the Network tab, then navigate to the URL. Or refresh the page while DevTools is open — click the reload button while on the Network tab to capture all initial page load requests including ones that fire before DOMContentLoaded.