ConvertersFebruary 2, 2025

How to Encode and Decode URLs

Dealing with special characters in URLs? Learn how to encode and decode URLs properly with our free online tool — and avoid broken links forever.

url encodingpercent encodingweb developmentdeveloper tools

Have you ever pasted a URL into an email or message and seen it break because of special characters? Or noticed strange %20 or %3D sequences in web addresses? That's URL encoding (also called percent-encoding) at work — a fundamental web standard that ensures URLs are transmitted correctly.

In this guide, we'll explain what URL encoding is, why it matters, and how to encode and decode URLs instantly using ToolMix's free URL Encoder/Decoder.

What Is URL Encoding?

URL encoding converts characters that aren't allowed in URLs into a format that can be safely transmitted. It replaces unsafe characters with a percent sign (%) followed by two hexadecimal digits representing the character's ASCII code. For example, a space becomes %20, and an ampersand (&) becomes %26.

Characters That Need Encoding

  • Spaces → %20 (or + in form data)
  • & → %26 (ampersand separates query parameters)
  • = → %3D (equals sign separates key-value pairs)
  • ? → %3F (marks the start of query string)
  • # → %23 (marks fragment identifier)
  • / → %2F (path separator)
  • + → %2B (has special meaning in form data)
  • Non-ASCII characters → Multiple percent-encoded bytes (UTF-8)

How to Encode/Decode URLs Online (Step-by-Step)

Step 1: Open the URL Encoder

Navigate to ToolMix's free URL Encoder/Decoder. It handles encoding and decoding instantly in your browser.

Step 2: Paste Your Text or URL

Enter the text you need to encode for use in a URL, or paste an encoded URL you need to decode back to readable text.

Step 3: Click Encode or Decode

Choose the operation and get instant results. The tool properly handles multi-byte UTF-8 characters and all reserved URL characters.

🔗 Try our free URL Encoder/Decoder

Try it free

encodeURI vs encodeURIComponent

JavaScript provides two encoding functions with different behaviors. encodeURI() encodes a complete URI, preserving characters that have special meaning in URLs (like :, /, ?, and &). encodeURIComponent() encodes everything except alphanumeric characters, making it suitable for individual query parameter values.

Rule of thumb: Use encodeURIComponent() for query parameter values, and encodeURI() only when encoding a complete URL that should remain navigable.

Frequently Asked Questions

Frequently Asked Questions

When should I URL-encode?

Encode when including user input in URLs, building query parameters with special characters, or creating redirect URLs that contain other URLs.

What's the difference between %20 and +?

%20 is the standard URL encoding for a space. + is used only in application/x-www-form-urlencoded format (form submissions). In URLs, use %20.

Do I need to encode the entire URL?

No. Only encode the parts that contain special characters, typically query parameter values. Encoding the entire URL would break its structure.

Try the Tool

Related Articles