🔀 cURL to Java
Paste a curl command, get working Java for five HTTP clients. No request is ever sent.
Paste a curl command on the left
Five clients · nothing is ever sent · 100% privateFrom a curl command to Java
Every browser's network tab has a "Copy as cURL", every API's docs open with a curl example, and every Java service then needs the same request expressed in whichever HTTP client that codebase uses. That translation is mechanical, and it goes wrong in the same three places every time.
The quoting
A real curl command is mostly a quoted JSON body full of spaces, colons, braces and escaped quotes. Converters that split on whitespace mangle it while looking like they worked. This one tokenises the way a shell does — single quotes literal, double quotes with backslash escapes — and joins Unix \, Windows ^ and PowerShell backtick line continuations.
curl's defaults
-d with no -X means POST, and -d with no Content-Type means application/x-www-form-urlencoded — not JSON. That second one is behind a large share of the 415s people spend an afternoon on. -G moves the data into the query string instead of the body. All three are reproduced, and the converter says when it applied one.
What cannot be translated honestly
-k is one flag in curl and a JVM-wide hole in Java: it means installing a TrustManager that accepts every certificate. The converter refuses to generate it and explains why, because the alternative is a copy-pasteable snippet that silently disables TLS verification in a service.
Frequently asked
Does this send the request?
No, and it never will. Firing a request from this page would mean proxying it through our server, which is an open relay pointed at whatever host a stranger types — including addresses inside our own network. This tool is pure text: a curl command in, Java out, entirely in your browser.
Why did my -d body come out as form-urlencoded?
Because that is curl's default. -d without an explicit Content-Type sends application/x-www-form-urlencoded, not JSON — which is why so many hand-translated requests come back 415. The converter reproduces curl's behaviour and tells you when it did, so you can change it deliberately.
Why won't it translate -k / --insecure?
Because there is no small honest version. Disabling certificate verification in Java means installing a trust-all TrustManager, which switches off certificate checking far more broadly than the one request you were debugging. Generating that quietly would be the most damaging thing this tool could do, so it warns instead.
Which client should I pick?
java.net.http needs no dependency at all and is the right default on JDK 11+. RestTemplate is still what most existing Spring codebases use, WebClient is its supported successor, OkHttp is the standard on Android, and Feign is the declarative option if you are already on Spring Cloud.
It got my quoted JSON body wrong in another tool — why?
Almost every curl converter splits the command on whitespace, which mangles any quoted body containing spaces, colons or escaped quotes. This one tokenises the way a shell does: single quotes are literal, double quotes allow backslash escapes, and Unix, Windows and PowerShell line continuations are all joined.