CodeCraft

URL Encode / Decode

Percent-encode special URL characters, or decode %XX sequences back to originals.

How to Use

  1. Paste the string you want to process into the input box.
  2. Click Encode to convert special characters to %XX format.
  3. Click Decode to restore %XX sequences to their original characters.
  4. Click Copy in the result area to get the output.

About URL Encoder & Decoder

URL encoding (also called percent-encoding) converts characters that are not allowed in URLs into a % followed by two hexadecimal digits. For example, a space becomes %20, and & becomes %26. This is essential when passing user-supplied data in query strings or path segments. Without encoding, special characters like ?, &, =, and # can be misinterpreted as URL delimiters. This tool encodes and decodes both full URLs and individual URL components. Use component encoding for query parameter values, and full URL encoding when you need to preserve the URL structure while escaping special characters.

Use Cases

API Query Parameters

Encode special characters in URL parameters to prevent breaking the query string structure.

Decode Tracking URLs

Decode percent-encoded marketing/analytics URLs to see the actual destination and parameters.

Form Data Encoding

Understand application/x-www-form-urlencoded format used in HTML form submissions.

Debug Redirect Chains

Decode nested encoded URLs in OAuth callbacks or redirect parameters to trace the full flow.

Examples

Input
Hello World! 你好
Output
Hello%20World!%20%E4%BD%A0%E5%A5%BD

Spaces become %20, Chinese characters are UTF-8 encoded then percent-escaped (3 bytes each).

Input
https%3A%2F%2Fexample.com%2Fpath%3Fq%3Dtest
Output
https://example.com/path?q=test

Decoding reveals the original URL structure. %3A is ':', %2F is '/', %3F is '?'.

Common Pitfalls & Edge Cases

  • ⚠encodeURI() vs encodeURIComponent(): the former preserves URL structure characters (:/?#), the latter encodes everything.
  • ⚠Double-encoding happens when you encode an already-encoded string. Always decode first if unsure.
  • ⚠'+' means space in query strings (form encoding) but is literal in path segments. Use %20 for spaces in paths.
  • ⚠Non-ASCII characters are first converted to UTF-8 bytes, then each byte is percent-encoded.

🔒 Data Privacy

URL encoding/decoding uses JavaScript's built-in encodeURIComponent/decodeURIComponent. All processing is local.

Standards & References

Frequently Asked Questions

Comments (0)

Leave a comment

0/2000