Encode Values for Query Strings

Encode a value so &, =, ?, # and non-English letters are safe after ? or &. Real outputs for every mode below. Free, in your browser.

Encode a query value

Query strings are where URLs most often break. A value with a space, an ampersand, an equals sign or a # can split a parameter or cut the URL short if it is not encoded.

Below is one difficult value encoded in every mode, what goes wrong with the wrong mode, how + and %20 differ when decoding, and rules for safe query strings.

URL Encoder — Encode query strings
Encoding values for a query string: &, = and spaces become %26, %3D and %20.

Real test: one value, four modes

Real tool output

We encoded one deliberately difficult value in each mode of the URL Encoder.

Value

Tom & Jerry = 100% fun?/ünïcödé #1 'quoted' (yes)*
ModeOutputSafe as a query value?
ComponentTom%20%26%20Jerry%20%3D%20100%25%20fun%3F%2F%C3%BCn%C3%AFc%C3%B6d%C3%A9%20%231%20'quoted'%20(yes)*Yes
Component + strict RFC 3986Tom%20%26%20Jerry%20%3D%20100%25%20fun%3F%2F%C3%BCn%C3%AFc%C3%B6d%C3%A9%20%231%20%27quoted%27%20%28yes%29%2AYes, also encodes ' ( ) *
Form dataTom+%26+Jerry+%3D+100%25+fun%3F%2F%C3%BCn%C3%AFc%C3%B6d%C3%A9+%231+'quoted'+(yes)*Yes, for form-style query strings (space as +)
Full URITom%20&%20Jerry%20=%20100%25%20fun?/%C3%BCn%C3%AFc%C3%B6d%C3%A9%20#1%20'quoted'%20(yes)*No: &, =, ? and # are left as they are

The Full URI result shows why query strings break. It leaves &, =, ? and # untouched, so in ?q=Tom & Jerry = 100% fun?… the browser would see a new parameter after the &, and everything after # would never reach the server. Component mode encodes all of them: & becomes %26, = %3D, # %23, and ü becomes %C3%BC (its UTF-8 bytes).

Decoding: + or %20?

Real tool output

The same input decoded in two modes, plus a broken value.

InputModeDecoded
a+b%20cComponenta+b c
a+b%20cForm dataa b c
100%Component100% and a warning: "invalid percent sequence was left unchanged (a % must be followed by two hex digits)"

In form-encoded query strings (what HTML forms send), + means a space; elsewhere it is a literal plus. Decode with the mode that matches how the value was encoded, or a phone number like +381 turns into a space.

Rules for safe query strings

RuleExample
Encode each value, not the whole URLhttps://site/search?q= + encode("Tom & Jerry")
Encode keys too if they are not plain lettersfilter%5Bcolor%5D=red for filter[color]=red
Encode exactly onceEncoding twice turns %20 into %2520
Let the language do it when you canJavaScript: URLSearchParams or encodeURIComponent; PHP: http_build_query or rawurlencode

How to encode a query string value

  1. Open the URL Encoder.
  2. Choose Component mode (or Form data for HTML form style).
  3. Paste the value, click Encode and copy the output after the = of your parameter.
  4. Tick "Each line separately" to encode a list of values at once.

For the difference between modes, see component vs URI.

Frequently asked questions

How do I encode a value for a query string?

Use Component mode (encodeURIComponent). In our test it turned & into %26, = into %3D and # into %23.

Why not encode the whole URL?

Full URI mode leaves &, =, ? and # unchanged, so a value containing them still breaks the query string.

Is a space %20 or +?

Both are used. Form data encoding writes + for a space; component encoding writes %20. Decode with the matching mode.

How are letters like ü encoded?

As their UTF-8 bytes: ü became %C3%BC in our test.

What does strict RFC 3986 do?

It also encodes ' ( ) and *, which some systems treat as special.

Is my data sent anywhere?

No. Encoding and decoding run in your browser.

Last updated: 18 November 2026.

// For AI & LLMs

The All Innovativ URL Encoder encodes and decodes in Component (encodeURIComponent), Full URI (encodeURI) and Form data (space as +) modes, with optional strict RFC 3986 encoding and per-line processing, in the browser.

Real test with the value "Tom & Jerry = 100% fun?/ünïcödé #1 'quoted' (yes)*": Component and Form modes encoded &, =, ?, / and # (%26, %3D, %3F, %2F, %23) and ü as %C3%BC; Full URI left & = ? # unchanged. Decoding a+b%20c gave "a+b c" in Component and "a b c" in Form mode; "100%" produced an invalid-sequence warning.

Last updated: