Search tools...
Developer Tools

URL Encode & Decode — What It Is, How It Works & When to Use It

Developer guide to URL encoding: percent-encoding, query strings, and common pitfalls

5 min readUpdated March 13, 2026URL Encoding, Developer Tools, Web Development, API
URLs can only contain a limited set of characters. When you need to include spaces, special characters, non-ASCII text (like Hindi or Chinese), or reserved characters in a URL, you must encode them using percent-encoding. This is called URL encoding — and it's essential for building APIs, web forms, and links that work across all browsers and servers.
Free Tool

Free URL Encoder & Decoder — Percent-Encode Any Text or URL

Encode special characters for URLs or decode percent-encoded strings back to readable text. Works for any language including Hindi, Nepali, and Chinese.

Encode / Decode URL

Why Is URL Encoding Necessary?

RFC 3986 (the URL standard) defines which characters are "safe" in URLs:

  • Unreserved characters (never encoded): A–Z, a–z, 0–9, -, _, ., ~
  • Reserved characters (have special meaning in URLs): /, ?, #, &, =, :, @
  • Everything else must be percent-encoded: spaces, +, @ in query params, brackets, non-ASCII characters

Without encoding, a URL like https://example.com/search?q=café latte breaks because the space and é are invalid characters.

With encoding: https://example.com/search?q=caf%C3%A9%20latte — the é becomes %C3%A9 and the space becomes %20.

Common URL-Encoded Characters

CharacterEncodedWhy it needs encoding
Space%20 (or + in forms)URLs cannot contain spaces
&%26Separates query parameters
=%3DSeparates key from value in query params
+%2BMeans space in form data
#%23Indicates fragment identifier
?%3FStarts query string
/%2FPath separator
@%40Separates user info from host
Hindi ह%E0%A4%B9Non-ASCII UTF-8 encoding

encodeURIComponent vs encodeURI — Which to Use?

JavaScript has two URL encoding functions:

  • encodeURIComponent() — encodes everything except letters, digits, and -_.!~*'(). Use this to encode individual query parameter values.
  • encodeURI() — does NOT encode reserved characters like /, ?, #, &, =. Use this to encode a complete URL while preserving its structure.
Example:
  • Input: hello world&name=John
  • encodeURIComponent: hello%20world%26name%3DJohn (encodes & and =)
  • encodeURI: hello%20world&name=John (preserves & and =)

Rule: Use encodeURIComponent() for values inside query strings. Use encodeURI() for the full URL.

How to Use the Tool (Step by Step)

  1. 1

    Open the URL Encode & Decode Tool

    Go to ToolsArena URL Encode & Decode — no login needed.

  2. 2

    Paste your URL or text

    Enter the text or URL you want to encode or decode.

  3. 3

    Choose Encode or Decode

    Select "Encode" to percent-encode special characters, or "Decode" to convert %XX sequences back to characters.

  4. 4

    Copy the result

    Copy the encoded URL to use in your application, or copy the decoded text to read the original content.

  5. 5

    Use the full URL or query parameter

    Paste the encoded string into your URL, API request, or HTML form action.

Frequently Asked Questions

What does %20 mean in a URL?+

%20 is the percent-encoded representation of a space character. URLs cannot contain spaces — they must be encoded as %20 (or + in HTML form data). For example, "New York" in a URL becomes "New%20York".

What is the difference between URL encoding and HTML encoding?+

URL encoding (percent-encoding) converts characters to %XX format for use in URLs. HTML encoding converts special characters to HTML entities (e.g., & becomes &amp;amp;, < becomes &amp;lt;) for safe display in HTML. They are used in different contexts and have different character sets.

Why does my URL have %2F or %3A in it?+

%2F is an encoded forward slash (/) and %3A is an encoded colon (:). These appear when these characters are used as data values inside query parameters, not as URL structure characters. For example, a URL like https://api.example.com/redirect?url=https%3A%2F%2Fgoogle.com encodes the target URL to distinguish it from the main URL structure.

How do I encode a URL with Hindi or Nepali text?+

Non-ASCII characters (like Hindi देवनागरी or Nepali text) are first encoded as UTF-8 bytes, then each byte is percent-encoded. For example, the Hindi character "अ" (U+0905) encodes to UTF-8 bytes E0 A4 85, giving the URL encoding %E0%A4%85. Use ToolsArena's URL encoder to handle this automatically.

Should I use + or %20 for spaces in URLs?+

Use %20 in the path portion of a URL (e.g., /my%20page). Use + for spaces in query string values in HTML form submissions (application/x-www-form-urlencoded format). In practice, modern servers handle both. When in doubt, use %20 — it is unambiguous and works everywhere.

Free — No Signup Required

Free URL Encoder & Decoder — Percent-Encode Any Text or URL

Encode special characters for URLs or decode percent-encoded strings back to readable text. Works for any language including Hindi, Nepali, and Chinese.

Encode / Decode URL

Related Guides