Example

cURL --data-urlencode Examples

Convert cURL commands that use --data-urlencode for search parameters, form posts, and GET query strings.

Try URL Encoded Conversion

POST form fields

--data-urlencode is commonly used for application/x-www-form-urlencoded form fields where spaces and special characters must be encoded safely.

GET query strings

When combined with -G, encoded data is moved to the URL query string and the generated request remains a GET request.

File and stdin warnings

If an encoded value asks curl to read from a local file or stdin, the converter reports a warning because an online parser cannot read that input.

URL encoded cURL

curl -G --data-urlencode 'q=hello world' --data-urlencode 'page=1' https://api.example.com/search

FAQ

What is the difference between -d and --data-urlencode?

-d sends text as provided, while --data-urlencode encodes names or values before sending them.

Can --data-urlencode be used with GET?

Yes. Use -G with --data-urlencode to append encoded values to the URL query string.