Skip to main content

    URL Encoder & Decoder

    Encode or decode URLs and query parameters. Supports encodeURI and encodeURIComponent.

    Free to use. Runs in your browser.

    Paste a URL to percent-encode special characters for safe transmission, or decode an encoded URL back to readable form. Handles both component and full-URI encoding.

    Encode parameter values with component mode, and use full-URI mode only when the URL structure is already in place.

    Common Encodings

    Space%20
    &%26
    =%3D
    ?%3F
    /%2F
    #%23
    +%2B
    @%40

    Why URLs Need Encoding

    URLs can only contain a limited set of characters: letters, numbers, and a few special characters like hyphens and underscores. Everything else, spaces, ampersands, question marks, non-ASCII characters, must be "percent-encoded" to travel safely through browsers, servers, and APIs.

    Percent-encoding replaces each unsafe character with a % followed by two hex digits. A space becomes %20. An ampersand becomes %26. The Japanese character "東" becomes %E6%9D%B1. It's the postal code of the web, ensuring your data arrives at the right destination without corruption.

    This matters more than you think. A URL with an unencoded & in a query parameter can break the entire request. An unencoded space might silently truncate your data. URL encoding prevents these bugs before they happen.

    Characters That Need Encoding

    CharacterEncodedWhy It's Reserved
    Space%20 (or +)Separates URL segments
    &%26Separates query parameters
    =%3DSeparates key from value in params
    ?%3FMarks start of query string
    #%23Marks fragment/anchor
    /%2FSeparates path segments
    @%40Used in email/authentication URLs
    +%2BInterpreted as space in form data

    What this means for you: If you're building URLs dynamically (API calls, redirects, tracking links), always encode parameter values. Most programming languages have built-in functions: encodeURIComponent() in JS, urllib.parse.quote() in Python, URLEncoder.encode() in Java.

    encodeURI vs encodeURIComponent

    encodeURI()

    Encodes a full URL but leaves reserved characters (: / ? # @ & = +) intact. Use it when you have a complete URL with spaces or non-ASCII characters in the path.

    encodeURIComponent()

    Encodes everything except letters, digits, and - _ . ~. Use it for individual query parameter values. This is what you need 90% of the time.

    Common Encoding Mistakes

    Bug

    Double encoding

    Encoding an already-encoded string turns %20 into %2520. This happens when a framework auto-encodes and you've already encoded manually. Decode first, or let only one layer handle encoding.

    Bug

    Encoding the full URL instead of just the value

    Using encodeURIComponent() on an entire URL turns the :// into %3A%2F%2F, breaking the link. Use encodeURI() for full URLs, encodeURIComponent() for individual parameter values only.

    Bug

    Space as + vs %20

    HTML forms encode spaces as +, but URLs use %20. If you're building a URL from form data, replace + with %20. Most current APIs expect %20, but some legacy systems still expect +.

    Query Parameter Example

    The safest pattern is to encode each value, then assemble the URL. The key and structural separators stay readable, while spaces and reserved characters inside the value are protected.

    PartRaw ValueEncoded ValueReason
    Search termcoffee & teacoffee%20%26%20teaThe ampersand would otherwise start a new parameter
    Return URLhttps://example.com/a?x=1https%3A%2F%2Fexample.com%2Fa%3Fx%3D1The nested URL needs to stay inside one value
    Fragment textsection #2section%20%232An unencoded # would start a fragment

    A finished URL might look like /search?q=coffee%20%26%20tea. The equal sign and ampersand separators are URL structure, not data.

    Path, Query, and Fragment Rules

    Path segments

    Encode each path segment separately if user text becomes part of a path. A slash inside a name should become %2F, otherwise it creates a new path segment.

    Query values

    Query values are where encodeURIComponent is most useful. Encode the value, then join it to the key with = and to other parameters with &.

    Fragments

    The fragment starts after # and is not sent to the server in normal HTTP requests. Encode user text inside it if it contains spaces or punctuation.

    Already parsed URLs

    If you are writing application code, the URL and URLSearchParams APIs usually handle this better than string concatenation.

    Decoding Safely

    Decoding makes a URL easier to inspect, but decoded text can change how a browser or server interprets the string. Treat decoded output as a debugging view unless you know the target context.

    EncodedDecodedWhat It Could Change
    %26&May split one query value into two parameters
    %23#May turn the rest of the URL into a fragment
    %2F/May change a path value into a path separator
    %2B+May be interpreted as a space by form-style decoders

    Troubleshooting URL Bugs

    The server sees missing parameters

    Look for an unencoded ampersand inside a value. For example, q=R&D is read as q=R plus an empty D parameter unless the ampersand becomes %26.

    The link stops halfway through

    An unencoded # starts the fragment section. If # is part of the value, encode it as %23 before building the link.

    The decoded output still has percent signs

    It may be double encoded. Decode once to turn %2520 into %20, then decode again only if you are sure the original data really was encoded twice.

    A plus sign became a space

    Some form decoders treat + as a space. Encode a literal plus sign as %2B when it needs to survive unchanged.

    Encoding Decision Guide

    TaskEncodeLeave Alone
    Add a search termThe query valueThe ?q= structure
    Add a file name to a pathThe file name segmentThe slash between path segments
    Nest a return URLThe whole return URL as one valueThe outer URL structure
    Share a readable full URLOnly unsafe characters inside data partsProtocol, host, path separators, and parameter separators

    When in doubt, identify the smallest data value first, encode that value, then put it back into the URL structure.

    Related Tools

    How to use this tool

    1

    Paste a URL or encoded string

    2

    Choose Encode (Component or URI) or Decode

    3

    Copy the result

    Common uses

    • Encoding query parameter values for API calls
    • Decoding percent-encoded URLs for debugging
    • Preparing redirect URLs with special characters
    • Encoding form data for POST requests
    • Making URLs safe for sharing and bookmarking

    Share this tool

    Frequently Asked Questions

    What is URL encoding?
    URL encoding (percent-encoding) replaces unsafe characters with a '%' followed by two hex digits. A space becomes %20, an ampersand becomes %26, and a question mark becomes %3F. Without encoding, these characters break URLs because they have special structural meaning.
    What's the difference between encodeURI and encodeURIComponent?
    encodeURI() encodes a complete URL but leaves structural characters (: / ? # @ & = +) intact. encodeURIComponent() encodes everything except letters, digits, and - _ . ~. Use encodeURIComponent() 90% of the time, it's what you need for query parameter values.
    Why does my URL break when I don't encode it?
    Characters like &, =, ?, and # have special meaning in URLs. An unencoded & in a query value gets interpreted as a parameter separator. An unencoded # truncates everything after it. Encoding prevents the browser from misinterpreting data characters as structural ones.
    Should I encode the entire URL or just parts of it?
    Encode individual parameter values, not the entire URL. If you encode the whole thing, you'll break the protocol (://), path separators (/), and query delimiters (?&=). Use encodeURIComponent() on each value, then build the URL from encoded parts.
    What's the difference between %20 and + for spaces?
    Both represent a space, but in different contexts. %20 is the standard URL encoding. + is used in application/x-www-form-urlencoded format (HTML form submissions). encodeURIComponent() produces %20. URLSearchParams produces +. Most servers accept both.
    How do I encode URLs in JavaScript?
    Use encodeURIComponent() for parameter values: 'key=' + encodeURIComponent(value). For building full URLs with multiple parameters, use the URL and URLSearchParams APIs: new URL('https://example.com'); url.searchParams.set('q', 'hello world').
    Can URL encoding handle Unicode and emojis?
    Yes. Unicode characters get encoded as their UTF-8 byte sequences. The emoji 'πŸŽ‰' becomes %F0%9F%8E%89 (four bytes). Non-Latin characters work the same way, '東京' becomes %E6%9D%B1%E4%BA%AC. Modern browsers handle this automatically in the address bar.
    Is double-encoding a problem?
    Yes, and it's a common bug. If you encode an already-encoded string, %20 becomes %2520 (the % gets encoded to %25). Always encode raw values, never pre-encoded strings. If you're seeing %25 in your URLs, you're double-encoding somewhere.
    What characters don't need encoding in URLs?
    Unreserved characters are safe without encoding: A-Z, a-z, 0-9, hyphen (-), underscore (_), period (.), and tilde (~). Everything else either has a reserved meaning or could cause problems and should be encoded.
    How does URL encoding work in different programming languages?
    JavaScript: encodeURIComponent(). Python: urllib.parse.quote(). Java: URLEncoder.encode(str, 'UTF-8'). PHP: urlencode(). Ruby: CGI.escape(). Go: url.QueryEscape(). C#: Uri.EscapeDataString(). Each handles the standard slightly differently, check which characters each function encodes.
    Is anything uploaded while I encode or decode?
    No. All encoding and decoding runs in your browser using JavaScript's built-in encodeURIComponent() and decodeURIComponent() functions. Nothing is sent to a server.
    What's the maximum URL length I can use?
    The HTTP spec has no limit, but browsers do. Chrome supports ~2MB in the address bar. Internet Explorer was famously limited to 2,083 characters. For API calls, most servers cap at 8KB for URLs. If your URL is extremely long, consider using POST with a request body instead.

    Results are for general informational purposes only and should be checked before use. They are not professional advice. See our Disclaimer and Terms of Service.