Percent-encode text for safe use in a URL, or decode it back.
Reserved and unsafe characters for URLs — spaces, &, =, ?, #, /, and non-ASCII characters among others — are converted to a % followed by their byte value in hex (e.g. a space becomes %20). Letters, digits, and a small set of unreserved punctuation are left as-is.
Decoding expects well-formed %XX sequences (two valid hex digits after each %). A stray % not followed by two hex digits, or a cut-off sequence, isn't valid percent-encoding and causes the error message instead of a result.
This tool encodes/decodes a string the way you'd prepare a single query-parameter value (using encodeURIComponent), which escapes more characters — including / and & — than encoding a whole URL would, since those characters are meaningful in a full URL.