Runs in your browser
URL encoder
Percent-encode and decode.
What this does
Percent-encodes text so it is safe inside a URL, or decodes it back. Spaces, slashes,& and other characters that have a meaning in a URL are turned into % followed by two hex digits.
One piece at a time
This encodes a single value, such as a query parameter — the same thing encodeURIComponent does. It is not for encoding a whole URL, which has characters like : and / that should stay as they are.
Decoding can fail
A lone %, or one not followed by two valid hex digits, is not valid percent-encoding. Decoding it gives a clear error instead of silently dropping characters.