cURL to Java converter
Paste a cURL command, for example from your browser's Network tab, and get ready-to-use Java (HttpClient, WebClient, RestTemplate, OkHttp, Apache HC5), or JavaScript, Python and Go.
From the browser's Network tab to working Java
A very common debugging loop: you find the request that works in the browser, copy it as cURL, and then need the same call in your Java service. Translating by hand is tedious and easy to get wrong: quoting, headers, the body, authentication, timeouts, redirects and the different ways each library wants them.
The converter reads the command like a shell would (single and double quotes, line continuations, $'...' strings), understands the common options (-X -H -d --data-raw --data-urlencode -F -u -G -I -L -k --compressed --json -m) and generates idiomatic code for Java 11 HttpClient, Spring WebClient, RestTemplate, OkHttp and Apache HttpClient 5. JavaScript fetch, Python requests and Go net/http are included because teams rarely use only one language.
The output includes the details that usually bite: restricted headers that Java's HttpClient rejects, Basic auth turned into the library's own helper, the JSON body typed as a record when you choose the typed variant, and clear notes where cURL's behaviour (for example -k) has no one-line equivalent. Everything runs locally, so tokens in your command stay on your machine.
Frequently asked questions
How do I get a cURL command from my browser?
Open DevTools, go to the Network tab, right-click the request and choose "Copy as cURL (bash)". On Windows, pick the bash variant, not the cmd one. Paste it here.
Why does the Java HttpClient code drop my Content-Length header?
Java's HttpClient sets Content-Length, Host, Connection and a few other headers itself and throws IllegalArgumentException: restricted header name if you set them. The converter removes them and tells you.
What is the "typed record" option?
When the body is JSON, it generates a Java record for the payload and sends it with Jackson's ObjectMapper, instead of pasting a raw JSON string into your source.
Is my command, with its token, sent anywhere?
No. Parsing and code generation happen in your browser. Tokens and cookies in a copied command never leave the page.