Encode a URL for an API Request

Percent-encode path and query values before calling an API. Avoid 400s caused by spaces, Unicode and reserved characters.

Part of the free URL Encoder. Runs in your browser — nothing is uploaded.

Encode a URL for an API Request

REST paths and query strings are not “just strings”. A user ID that contains a slash, or a filter that contains &, must be encoded or the server sees a different path. Encode each inserted value.

Worked example: A filter value in a query

Text

status=on hold & city=São Paulo

Encoded

filter=status%3Don%20hold%20%26%20city%3DS%C3%A3o%20Paulo

Practical tip

Most HTTP clients encode for you if you pass params as an object. Encoding again produces %2520. Check before you double-encode.

How to use this URL Encoder

  1. 1Use the live tool above — it runs entirely in your browser and never uploads your data.
  2. 2Paste the sample from the worked example, or use your own input.
  3. 3Copy the result, then adapt the same steps in your editor, script, or pipeline.

Encode a URL for an API Request FAQs

Should I encode the base URL?

No. Leave https://host/path as it is. Encode only the values you interpolate.

What about JSON bodies?

JSON in a POST body is not URL-encoded. Use JSON.stringify and Content-Type: application/json.