ExampleAddress

URL Encoding Examples: Spaces, Plus and Percent Signs

Percent encoding represents bytes as % followed by two hexadecimal digits. Encode the relevant URL component; encoding an entire URL as one component changes its separators.

Examples at a glance

A space

Encoded path
/a%20b

%20 represents a space here.

Readable text
a b

The corresponding text.

A literal plus

Encoded query
q=C%2B%2B

%2B represents each literal +.

Decoded value
C++

The value after form-style query decoding.

A query-space shorthand

Encoded query
q=hello+world

URLSearchParams interprets + as a space.

Decoded value
hello world

This + is not a literal plus.

Plus is context dependent

In a path, + can be a literal plus. URLSearchParams treats + as a space in a form-style query. %2B encodes a literal plus there, while %20 represents a space.

Unicode and double encoding

UTF-8 characters may require several percent-encoded bytes. Encoding an already encoded %20 as a component can produce %2520; repeated decoding can also change meaning unexpectedly.

Inspect rather than rewrite blindly

The URL analyzer shows encoded path/query text separately from decoded query pairs. This page explains encoding; it does not promise a universal encoder for every URI scheme or application.

Related guides and tools

Primary sources