URL encode Postman variable?

I am late but still worth it:

Just highlight and right click the part of url you want to encode. Select encodeURIComponent

That's it.

enter image description here


Use the Pre-request scripts (it's next to body) for this:

var encoded = encodeURIComponent({{phone number}});

or

var encoded = encodeURIComponent(pm.environment.get("phone number"));

and to proceed, use:

pm.environment.set("encoded phone number", encoded);

And set your URL to /path/get?phone={{encoded phone number}}


The trick is to get your environment variable in the pre-request script and then set it after encoding it

    var encoded = encodeURIComponent(pm.environment.get("phone"));
    pm.environment.set("encoded phone number", encoded);

Just a shortcut to Mohhamad Hasham' answer.

You can encode and decode direct in the Params Value field: enter image description here