URL Encode / DecodeFree online other calculator — instant results, no sign-up
Percent-encode text for URLs or decode it.
About the URL Encode / Decode
This tool encodes raw text into percent-encoded Uniform Resource Identifier (URI) components and attempts to decode percent-encoded strings back into plain text. Web developers, API designers, and data engineers use it to safely pass parameters, special characters, and non-ASCII text inside URL query strings.
- Text
- Any plain text string or percent-encoded URI string you want to encode or decode.
Formula and method
Encoded = encodeURIComponent(Text), Decoded = decodeURIComponent(Text)
- encodeURIComponent(x)JavaScript function converting characters (except A-Z, a-z, 0-9, -, _, ., !, ~, *, ', (, )) into UTF-8 escape sequences of the form %XX
- decodeURIComponent(x)JavaScript function reversing valid percent-encoded UTF-8 byte sequences back into UTF-16 code units
The tool applies JavaScript's native encodeURIComponent function to translate non-standard URI characters into UTF-8 byte sequences preceded by '%'. Simultaneously, it passes the input to decodeURIComponent inside a try-catch block; if the input is not a valid percent-encoded string, the decoded output defaults to an em dash ('—').
Worked example
These are the calculator's starting values and the results it actually produces for them.
Inputs
- Texta b&c=d/é
Results
- Encodeda%20b%26c%3Dd%2F%C3%A9
- Decodeda b&c=d/é
How to use the URL Encode / Decode
- 1Enter the raw string or percent-encoded text into the input field.
- 2Evaluate the input with encodeURIComponent to generate the percent-encoded version.
- 3Attempt to parse the input with decodeURIComponent to generate the decoded plain text.
- 4Return the encoded string alongside the decoded string, or show '—' if decoding encounters a malformed URI sequence.
Reading your result
The 'Encoded' row displays the safe string formatted for URL query parameters, replacing reserved delimiters and non-ASCII characters with percent sequences. The 'Decoded' row displays the original human-readable text if the input contained valid percent sequences; if the input contained an invalid percent sequence (such as a single '%'), it returns '—'.
Limitations
The implementation relies strictly on JavaScript's encodeURIComponent, which leaves characters like exclamation marks (!), single quotes ('), asterisks (*), and parentheses untouched. It is intended for URI components (query values) rather than full URLs, so protocol slashes and query delimiters like '?' and '&' are encoded. Additionally, malformed percent sequences fail silently to decode and display '—' without specific error diagnostics.
Common questions
Why does the decoded result show an em dash ('—')?+
An em dash appears when the input contains a malformed percent-encoding sequence, such as a trailing '%' not followed by two valid hexadecimal characters, or an invalid UTF-8 byte sequence that decodeURIComponent cannot parse.
What is the difference between encoding a full URL and a URI component?+
A full URL encoder preserves structural delimiters such as 'http://', '?', and '&', whereas component encoding transforms those characters into '%2F', '%3F', and '%26' so they can be safely passed as parameter values.
Why aren't characters like '-', '_', or '*' encoded?+
According to URI specifications (RFC 2396 and RFC 3986), unreserved characters including alphanumeric letters, hyphens, underscores, periods, and tildes are considered safe in URI components and do not require percent-encoding.
Does the calculator save my information?+
Calculations run in your browser. While signed in, inputs and results are automatically recorded in account history; saving a result creates a separate saved record.
You might also like
IP Subnet Calculator
Network, broadcast and host range of an IPv4 subnet.
Password Generator
Create a strong random password.
Voltage Drop Calculator
Voltage drop on a copper conductor.
GDP Calculator
GDP by the expenditure approach.
Horsepower Calculator
Horsepower from torque and RPM.
Engine Horsepower Calculator
Estimate horsepower from weight and quarter-mile time.
Results are estimates for informational purposes and are not financial, medical or legal advice.