cURL to PowerShell

Paste a curl command and get PowerShell code using Invoke-RestMethod — or pick any other language.

Paste a curl command above to generate code

How curl maps to PowerShell (Invoke-RestMethod)

  • →In Windows PowerShell 5.1, curl is an alias for Invoke-WebRequest, so pasted curl commands fail — this converts them properly.
  • →Invoke-RestMethod parses JSON responses into objects automatically.
  • →Values use single quotes, so $ and backticks in tokens aren't expanded.

Frequently asked

Why doesn't curl work in PowerShell?

In Windows PowerShell 5.1, curl is an alias for Invoke-WebRequest, which has different parameters. Use curl.exe to run real curl, or convert the command to Invoke-RestMethod here.

Invoke-RestMethod or Invoke-WebRequest?

Invoke-RestMethod returns the parsed body (JSON becomes objects). Invoke-WebRequest returns the whole response, including status code and headers.

ToolNinja