URL Encoder / Decoder
Convert text between percent-encoded URL form and plain text using encodeURIComponent or decodeURIComponent.
Real-time Results
Encoded URL Output
https%3A%2F%2Fcalnex.pro%2Fsearch%3Fquery%3Dhello%20world!
How it works
This tool applies JavaScript percent-encoding to a text string, or reverses existing percent-encoded sequences back to plain text. It is useful for preparing query values or inspecting encoded links.
Does encoding change the whole URL or only a query value?
encodeURIComponent escapes characters such as : / ? & = and spaces, so the entire string is treated as one component. If you paste a full URL, the scheme and separators are encoded too, which is not the same as encoding only a query parameter value. Encode the value alone when you need a usable link.
What happens with malformed percent sequences in decode mode?
decodeURIComponent throws on invalid sequences such as a lone % or %ZZ. The engine catches this and returns the fixed text Decoding error: Input text contains invalid URL-encoded sequences. rather than a partial result, so check the source string before relying on the output.
Examples and interpretation(2)
How do I encode a query value containing a space, ampersand and equals sign?
- Input Text
- a b&c=d
- Conversion Mode
- URL Encode
- Enter a b&c=d in Input Text and select URL Encode.
- encodeURIComponent leaves a, b, c, d unchanged, maps the space to %20, & to %26 and = to %3D.
- The output is a%20b%26c%3Dd.
- Encoded URL Output
- a%20b%26c%3Dd
The result is safe to place inside a query parameter value. Note that spaces become %20, not +, so form-style encoding differs.
How do I turn a percent-encoded string back into readable text?
- Input Text
- a%20b%26c%3Dd
- Conversion Mode
- URL Decode
- Enter a%20b%26c%3Dd in Input Text and select URL Decode.
- decodeURIComponent resolves %20 to a space, %26 to & and %3D to =.
- The output is a b&c=d.
- Encoded URL Output
- a b&c=d
Decoding restores the original characters exactly. If any triplet is malformed, the tool returns an error message instead of text.
Inputs
| Parameter | Definition & Valid Bounds |
|---|---|
| Conversion Mode | URL Encode · URL Decode |
Formula
Encode: output = encodeURIComponent(text). Decode: output = decodeURIComponent(text).
How to use
- Paste the source string into Input Text; the default is the sample link with a space and exclamation mark.
- Choose Conversion Mode: URL Encode or URL Decode.
- For encoding, the engine calls encodeURIComponent on the exact text, escaping reserved characters and spaces.
- For decoding, the engine calls decodeURIComponent; invalid sequences produce a decoding error message instead of a value.
- Read the single output, labeled Encoded URL Output or Decoded URL Output depending on the mode.
Frequently asked questions
Why does encoding a full URL produce %3A%2F%2F instead of keeping the slashes?
The engine uses encodeURIComponent, which escapes reserved characters including : / ? & = and spaces. A full URL therefore becomes one encoded component; encode only the parameter value if you need the surrounding URL structure intact.
Are plus signs treated as spaces when decoding?
No. decodeURIComponent does not convert + to a space, so a + in the input stays a +. Only percent triplets such as %20 are decoded.
Is the input trimmed before conversion?
Validation trims the text only to check that it is non-empty. The conversion itself uses the raw string, so leading and trailing spaces are encoded or decoded as part of the output.
Related Calculators
More calculators selected by category and topic.
