URL Encoder Decoder
Encode special characters in URLs or decode percent-encoded strings
Complete APIWhat Is the URL Encoder Decoder Tool?
The URL encoder decoder is a free browser-based utility that converts ordinary text into percent-encoded format and decodes percent-encoded strings back to their original form. URLs on the web allow only a restricted set of characters: letters, digits, hyphens, underscores, and periods. Characters like spaces, quotes, ampersands, question marks, brackets, carets, and non-ASCII symbols must be encoded as a percent sign followed by two hexadecimal digits. This tool handles both directions using JavaScript native functions encodeURIComponent, encodeURI, decodeURIComponent, and decodeURI. Everything runs inside your browser with zero server communication. You get two encoding methods to choose the right strictness for each use case, live counters that show exactly what happens to your data, and instant auto-updating results.
Encode URL vs Decode URL Mode
The mode toggle bar at the top of the tool contains two buttons that determine the direction of the conversion. Click Encode URL to activate encoding mode the input expects plain text and the output produces percent-encoded characters. Click Decode URL to reverse the operation the input accepts percent-encoded strings and the output returns readable text. Every interface element reflects the current mode. The input panel title switches between Plain Text / URL and Encoded URL. The output panel title updates accordingly. The Convert button text changes between Encode and Decode. The textarea placeholder adapts to guide you. The active button lights up with a teal gradient while the inactive button stays neutral, giving you an immediate visual cue. Switching modes preserves your input so you can encode and immediately switch to decode for verification.
EncodeURIComponent vs EncodeURI Method
The Method radio group below the mode bar controls how aggressively the tool encodes special characters. encodeURIComponent encodes every special character without exception, including :, /, ?, #, @, &, and =. This is the correct choice for encoding query parameter values, form fields, and hash fragments where no character should alter the URL structure. encodeURI preserves URL syntax characters colon, slash, question mark, hash, at sign, ampersand, and equals sign so the encoded string remains a functional web address. Select your method by clicking the radio button. The chosen option highlights with a teal border and background for clear visual feedback. Both methods handle the same unsafe characters: spaces, quotes, angle brackets, backslashes, carets, and non-ASCII text.
| Character | encodeURIComponent | encodeURI |
|---|---|---|
| Space | %20 | %20 |
| Ampersand & | %26 | Preserved |
| Equals = | %3D | Preserved |
| Question ? | %3F | Preserved |
| Slash / | %2F | Preserved |
| Hash # | %23 | Preserved |
| Colon : | %3A | Preserved |
| At @ | %40 | Preserved |
Input Panel Paste, Type, and Clear
The input panel on the left accepts the text or URL you want to process. You can type directly into the monospace textarea. Click the Paste button in the panel header to read content from your clipboard using the Clipboard API it fills the textarea and triggers automatic conversion. The Clear button empties the input, resets the character and line counters to zero, and also clears the output panel. The placeholder text inside the textarea changes dynamically. In Encode mode it says Paste your URL or text here.... In Decode mode it says Paste encoded URL here (e.g. hello%20world). Every keystroke, paste, or clear event fires the conversion automatically through the oninput handler, keeping the output in sync without requiring extra clicks.
oninput event on the textarea. Every character you type, every paste, and every clear action immediately triggers the encoding or decoding function. The Convert button is available for explicit triggering but is rarely needed during normal use.Convert Action and Output Panel
The Convert button sits between the two panels and displays an arrow followed by Encode or Decode depending on the active mode. Clicking it reads the input, applies the selected method, and writes the result to the output panel. The output panel displays the result in a readonly textarea with a light teal background to visually distinguish it from the input. The Copy button copies the result to your clipboard it briefly shows a checkmark for two seconds as confirmation, then reverts to the original label. The Clear button empties only the output panel without affecting the input, letting you reset the result while keeping your original text for further editing. The output panel title updates dynamically to show Encoded URL or Decoded URL based on the current mode.
Swap Feature and Round-Trip Verification
The Swap button performs three operations in a single click. It reads the current output, places it into the input textarea, and automatically switches the mode to the opposite operation. If you were encoding, Swap moves the encoded result to the input and changes to Decode mode so you can verify the round trip. If you were decoding, it does the reverse. The button refuses to operate when the output is empty or contains an error message, preventing accidental invalid swaps. This feature is essential for data integrity testing encode a string, swap, decode, and confirm the output matches your original input. Power users rely on this for every parameter encoding task.
Live Counters Chars, Lines, and Size Diff
Below each textarea, the tool displays real-time counters that update as content changes. The input footer shows the character count and line count of the input. The output footer shows the character count of the result and a size difference indicator. When encoding, special characters expand from one to three characters (percent sign plus two hex digits), so the output is longer the indicator shows a plus sign and the number of added characters. When decoding, percent-encoded sequences collapse back to single characters, shown with a minus sign. If the lengths match, the indicator reads same size. This feedback helps you understand encoding overhead, which matters when working within browser URL length limits (typically 2000 characters) and server-side constraints.
Complete Step-by-Step Workflow
Select Mode
Click Encode URL or Decode URL. The button highlights and all labels update.
Choose Method
Pick encodeURIComponent for strict or encodeURI for gentle encoding.
Enter Data
Type into the textarea or click Paste. Counters update live below.
Convert
Click Convert or let auto-update run. Result appears in output panel.
Copy Result
Click Copy in the output header. Checkmark confirms clipboard success.
Swap and Check
Click Swap to reverse the operation. Convert again to verify data integrity.
Real-World Applications
Form Submissions
Browsers encode form data automatically. Decode submitted values during testing to verify what users actually entered.
API Parameters
REST APIs need encoded query strings. Encode search terms and filters before appending them to endpoint URLs.
Share Links
Links with complex parameters must be encoded to survive email clients and messaging platforms without corruption.
Data Export
Some tools export URL-encoded data. Decode to read values and re-encode after modifications for re-import.
Common Mistakes and Solutions
Wrong Method Selection
Using encodeURI for parameters leaves & and = unencoded, breaking query strings. Always use encodeURIComponent for parameter values.
Double Encoding
Encoding an already-encoded string turns % into %25, producing garbled output. Decode first, then re-encode if needed.
Display Without Decoding
Showing users %20 and %26 looks broken. Always decode before displaying URLs in user-facing text.
Skipping Round-Trip
Not verifying with Swap hides errors. Always swap and decode to confirm your original data is intact.
Frequently Asked Questions
Browser and Mobile Compatibility
The URL encoder decoder works on every modern browser and device without installation. On desktop screens, the two panels sit side by side with the Convert and Swap buttons between them for efficient keyboard and mouse workflows. On mobile devices, the layout stacks vertically input at top, control buttons in the middle, output at bottom so the tool remains fully usable on phones and tablets. Copy and Paste use the standard Clipboard API with fallback behavior for older browsers. The tool loads no external scripts beyond the Google Font, making it instant on any connection speed and fully functional offline after the initial visit. Textareas support vertical resize on desktop and smooth scrolling on mobile, accommodating long URL strings on any screen size.
