Skip to content
Runs local · no upload

Encode and Decode URLs — Percent-Encoding Online

Paste any text or URL — encode it for safe use in query strings, or decode a percent-encoded URL back to readable form. Covers encodeURIComponent and encodeURI modes.

Ausgabe
Eingabe leer — oben einfügen, um die formatierte Ausgabe zu sehen.

How It Works

  1. 01

    Paste text or code

    Paste your content into the input field or type directly.

  2. 02

    Instant processing

    The tool processes your content immediately and shows the result.

  3. 03

    Copy result

    Copy the result to your clipboard with one click.

Privacy

All calculations run directly in your browser. No data is sent to any server.

URLs can only contain a limited set of characters. Everything else — spaces, non-ASCII letters, symbols like &, =, #, and ? — must be percent-encoded before being placed in a URL. This tool encodes and decodes in both directions, and clearly distinguishes between the two JavaScript encoding functions developers frequently confuse.

01 — How to Use

How do you use this tool?

  1. Paste your text or URL into the input field.
  2. Click 'Encode' to convert special characters to percent-encoded form.
  3. Click 'Decode' to convert a percent-encoded string back to readable text.
  4. Select the encoding mode: 'Component' (for query values) or 'Full URI' (for complete URLs).
  5. Copy the result with one click.

What This Tool Does

This URL encoder/decoder converts text to percent-encoded format for safe inclusion in URLs — and decodes percent-encoded strings back to human-readable text. It supports two encoding modes that match JavaScript’s built-in encodeURIComponent and encodeURI functions.

How It Works

The URL specification (RFC 3986) defines which characters are allowed in a URL without encoding:

  • Unreserved: A–Z a–z 0–9 - _ . ~
  • Reserved (structural): : / ? # [ ] @ ! $ & ' ( ) * + , ; =

Any character outside this set must be percent-encoded. The encoder converts each byte to %XX where XX is the uppercase hexadecimal byte value.

How Do Encoding Modes Work?

ModeLeaves UnencodedEncodesUse Case
encodeURIComponentUnreserved chars onlyAll reserved chars including / ? & = # :Query parameter values, form fields
encodeURIUnreserved + all reservedOnly characters outside both sets (e.g., spaces, non-ASCII)Complete URLs where structure must be preserved

Example — the difference matters:

Input: https://example.com/search?q=hello world&lang=en

  • encodeURIComponenthttps%3A%2F%2Fexample.com%2Fsearch%3Fq%3Dhello%20world%26lang%3Den (The entire URL becomes a single encoded blob — correct when passing this URL as a value inside another URL.)

  • encodeURIhttps://example.com/search?q=hello%20world&lang=en (Structure preserved, only the space encoded — correct when you want the URL to remain functional.)

What Are Common Use Cases?

Query string parameters. A search term like C++ programming must be encoded as C%2B%2B%20programming before appending to a URL. Unencoded + characters are interpreted as spaces by some servers.

Redirect URLs in OAuth. OAuth flows pass a redirect_uri parameter that itself contains a URL. The inner URL must be fully encoded with encodeURIComponent: ?redirect_uri=https%3A%2F%2Fmyapp.com%2Fcallback.

API endpoint construction. When building a REST API call that includes user-provided search terms, file names, or IDs, always encode the dynamic segments before concatenating them into the URL.

Decoding obfuscated links. Phishing emails and spam often use heavily encoded URLs to hide the destination. Paste the encoded URL here to decode it and inspect the actual target before clicking.

Debugging HTTP requests. When inspecting network traffic in browser DevTools, URLs in request logs are often percent-encoded. Decode them to read query parameters clearly.

File path encoding. File names with spaces or special characters in web URLs must be encoded. My Report (Final).pdf becomes My%20Report%20(Final).pdf — parentheses are safe in paths but encoded in query values.

What Are Common Encodings?

CharacterEncodedContext
Space%20All contexts
&%26Query values
=%3DQuery values
+%2BQuery values
#%23Query values
/%2FQuery values
?%3FQuery values
@%40Query values

Frequently Asked Questions

Is URL encoding the same as HTML encoding? No. HTML encoding (also called HTML entity encoding) replaces characters like <, >, and & with &lt;, &gt;, and &amp; for safe display in HTML. URL encoding is a separate standard for safe transmission in URLs. The two serve different purposes and should not be conflated.

Can I encode an entire JSON object for a query parameter? Yes. Serialize the JSON to a string with JSON.stringify(), then encode the result with encodeURIComponent. The encoded string can be used as a query parameter value. Decode and parse on the receiving end.

What if my URL is already partially encoded? Use the decode function first to bring it back to plain text, verify it looks correct, then re-encode cleanly. Applying encoding to an already-encoded string produces double-encoding (%2520 instead of %20).

Last updated:

You might also like