Skip to content
uencoder

Percent-Encoding

Percent-encoding is the mechanism that converts unsafe characters in URLs into %HH form, defined by RFC 3986.

Purpose

It lets arbitrary bytes appear safely in URL components while preserving the semantics of URL structural characters (/ ? # = &).

Mechanism

Each byte of an unsafe character becomes % followed by two uppercase hexadecimal digits. The reserved set depends on the component: paths allow / and queries allow ? = &. Unreserved characters (A-Z a-z 0-9 - _ . ~) are never encoded.

Use cases

  • URL query parameter encoding
  • RESTful path parameters
  • OAuth signature base string construction
  • S3 URL path encoding

Examples

  • Input
    hello world
    Output
    hello%20world

    A space encodes as %20

Common errors

Double encoding (an already-encoded % gets encoded again as %25)
Encode the raw value exactly once

Related terms

Related tools

Related tutorials

References