Convert curl to HTTP

curl2code converts curl commands to raw HTTP request format. The conversion runs in your browser via WebAssembly for complete privacy. For HAR format, check our curl to HAR converter. For HTTPie, see curl to HTTPie. Below are practical HTTP request examples.

How to copy curl from your browser

  1. 1

    Open DevTools

    Press F12 or Ctrl+Shift+I to open your browser developer tools.

  2. 2

    Go to the Network tab

    Click the Network tab and perform the action that triggers the HTTP request.

  3. 3

    Copy as cURL

    Right-click the request → CopyCopy as cURL. Then paste it above.

Frequently Asked Questions

What is the raw HTTP format?

Raw HTTP shows the actual protocol text sent over the wire: the request line (GET /path HTTP/1.1), headers, and body. It's the canonical representation defined in RFC 9110. curl2code generates the raw HTTP request format, which is useful for understanding exactly what a curl command does at the protocol level.

Raw HTTP vs HAR vs HTTPie — which format to choose?

Raw HTTP shows the exact protocol representation — best for learning and documentation. HAR is JSON-structured for tooling. HTTPie is a human-friendly CLI syntax. Choose raw HTTP for protocol understanding, HAR for analysis, HTTPie for scripts. See also curl to HAR and curl to HTTPie.

How does authentication look in raw HTTP?

Authentication appears as a header line: Authorization: Bearer token123 or Authorization: Basic dXNlcjpwYXNz. In raw HTTP, you see the exact header that gets sent — making it easy to verify auth is configured correctly. curl2code shows the complete request including auth headers.

How does form data look in raw HTTP?

Multipart form data shows the boundary, each part with its own Content-Disposition and Content-Type headers, separated by boundary strings. The Content-Type header includes multipart/form-data; boundary=.... Raw HTTP reveals the exact structure that libraries abstract away.

How are HTTP errors represented?

The response status line shows the code: HTTP/1.1 404 Not Found or HTTP/1.1 500 Internal Server Error. Response headers may include Retry-After for rate limiting or WWW-Authenticate for auth challenges. Understanding raw HTTP helps debug issues across any programming language.

What are the differences between HTTP versions?

HTTP/1.1 uses text-based headers and one request per connection (with keep-alive). HTTP/2 multiplexes requests over a single binary connection. HTTP/3 uses QUIC (UDP-based) for faster connection setup. curl supports all three with --http2 and --http3 flags.

What do common HTTP status codes mean?

200 OK, 201 Created, 204 No Content — success. 301/302 redirects. 400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found — client errors. 500 Internal Server Error, 502 Bad Gateway, 503 Service Unavailable — server errors. 429 Too Many Requests — rate limited.

How to use raw HTTP for debugging?

Compare the raw HTTP output from curl2code with actual network traffic (use curl -v for verbose output). Check headers, Content-Type, body encoding, and Content-Length match expectations. Tools like mitmproxy, Wireshark, and Fiddler show raw HTTP for any client. For CLI debugging, see curl to HTTPie.

How to represent a POST request with JSON body in Raw HTTP?

Use curl's -X POST -d '{"key":"value"}' -H "Content-Type: application/json" and curl2code will convert it to Raw HTTP format: POST /api/data HTTP/1.1 Content-Type: application/json {'key':'value'}. The JSON body and Content-Type header are preserved in the output. curl2code handles both inline JSON and @file.json references.

How to include Bearer token authorization in Raw HTTP?

When you convert curl -H "Authorization: Bearer YOUR_TOKEN" URL with curl2code, the Bearer token is preserved in the Raw HTTP output: Authorization: Bearer YOUR_TOKEN. Both -H "Authorization: Bearer ..." and OAuth token flags are detected automatically.

How is Content-Type represented in Raw HTTP format?

When converting curl -H "Content-Type: application/json" URL, curl2code outputs the Content-Type in Raw HTTP as: Content-Type: application/json. Common types include application/json, application/x-www-form-urlencoded, and multipart/form-data. curl2code preserves the exact Content-Type from the original curl command.

Useful Links

curl Guides

Convert curl to Other Languages