TechWeirdoTools

Encode or decode

Converts as you type. Non-ASCII characters are encoded as UTF-8.

URL parser

Paste a URL to inspect its parts. Edit, add or remove query parameters and copy the rebuilt URL.

How to URL-encode a string

  1. Choose Encode or Decode

    Encode converts reserved and non-ASCII characters into %XX sequences; Decode reverses it.

  2. Pick the right rules

    Use Component for a single query value or path segment, Full URL to keep / ? & = intact, and Form for HTML form bodies where spaces become +.

  3. Copy or inspect

    Copy the result, or send it to the URL parser to see every component and query parameter decoded.

encodeURIComponent vs encodeURI

URLs can only contain a limited set of ASCII characters. Everything else — spaces, accents, emoji and characters with special meaning like & or # — must be percent-encoded as the UTF-8 bytes in hexadecimal. A space becomes %20 and é becomes %C3%A9.

CharacterencodeURIComponentencodeURIForm (+)
space%20%20+
/ ? : @EncodedKeptEncoded
& = + #EncodedKeptEncoded
- _ . ~KeptKeptKept
é%C3%A9%C3%A9%C3%A9

Rule of thumb: build URLs by encoding each piece with encodeURIComponent (or URLSearchParams), not by encoding the whole URL at the end. Encoding a complete URL with encodeURIComponent will break it by escaping the :// and slashes.

In code

// JavaScript
encodeURIComponent("café & co")       // "caf%C3%A9%20%26%20co"
new URLSearchParams({ q: "café & co" }).toString()  // "q=caf%C3%A9+%26+co"

# Python
from urllib.parse import quote, quote_plus
quote("café & co")       # 'caf%C3%A9%20%26%20co'
quote_plus("café & co")  # 'caf%C3%A9+%26+co'

Frequently asked questions

What does %20 mean in a URL?

%20 is the percent-encoded form of a space character (byte 0x20). In HTML form submissions and some query strings, a space may instead be written as +.

Should spaces be encoded as %20 or +?

Use %20 in paths and in general. + means a space only in the application/x-www-form-urlencoded format used by HTML forms and URLSearchParams. Choose the Form option when you need that behaviour.

Why do I get a “URI malformed” error when decoding?

The input contains a % that isn’t followed by two hex digits, or a sequence of bytes that isn’t valid UTF-8 (for example a URL encoded in Latin-1). Fix or remove the stray % and try again.

Is my URL sent anywhere?

No. Encoding, decoding and parsing use your browser’s built-in functions and the URL API. Nothing is uploaded, and the URL is never requested.

What is double encoding?

Encoding an already-encoded string turns %20 into %2520. If you see %25 in a URL, something encoded it twice — decode once more to get the original.