Skip to main content
miji.be

Percent-Encoding

A mechanism for encoding special characters in URLs by replacing them with a percent sign followed by hexadecimal digits.

May 1, 2026 / About 1 min read

URL Shortening

Percent-encoding is the specific encoding mechanism used in URLs where each unsafe or reserved character is replaced by a percent sign (%) followed by two hexadecimal digits. This is the formal name for what is commonly called URL encoding. The term comes from the percent sign that prefixes each encoded character sequence.

The encoding process converts each byte of a character's UTF-8 representation into the %HH format. For single-byte ASCII characters, this produces one percent-encoded triplet. For multi-byte Unicode characters, multiple triplets are generated. For example, the Japanese character for "short" would be encoded as a series of percent-encoded bytes representing its UTF-8 encoding.

In practice, percent-encoding is handled automatically by web browsers, HTTP libraries, and URL shortening services. However, developers must understand it to correctly construct URLs programmatically, especially when building query strings with user-supplied values or handling internationalized domain names.

A common source of bugs is the difference between encodeURI() and encodeURIComponent() in JavaScript. The former encodes a complete URI and preserves structural characters like slashes and colons, while the latter encodes individual URI components and encodes those characters as well. Using the wrong function leads to malformed URLs.

Was this article helpful?

Related Terms

URL Encoding

URL encoding (percent-encoding) converts special characters into percent-encoded sequences (%XX) safe for use in URLs. Essential for handling spaces, Unicode characters, and reserved symbols in web addresses.

Short URL

A condensed version of a long URL that redirects to the original destination. Short URLs are easier to share and track.

SEO-Friendly URL

A URL structure designed to be easily understood by both search engines and human users.

Base62 Encoding

An encoding scheme that represents data using 62 alphanumeric characters (a-z, A-Z, 0-9). Widely used to generate short URL codes.

QR Code Encoding

The process of converting data into the pattern of modules that form a QR code.

Content Negotiation

A mechanism in which the client and server negotiate the optimal content format (language, media type, encoding) through HTTP headers.

Related Articles

How URL Shorteners Work - The Technical Side of Redirects

Discover the technical mechanics behind URL shortening: hash generation, database lookups, HTTP redirects, and more. Includes HTTP response examples and base-62 encoding calculations.

URL Shortener API Guide - Generating Short URLs Programmatically

A practical guide to using URL shortener APIs. Learn about request formats, response structures, authentication, and implementation patterns.

Short URL Accessibility - Screen Reader Compatibility, Link Text, and WCAG Compliance

How short URLs affect users with visual impairments, cognitive disabilities, and motor limitations. Covers screen reader behavior and WCAG guidelines.

FAQ

Which characters need percent encoding?
Non-ASCII characters (like Japanese), reserved characters (?, &, =, #, /, etc.), and spaces require encoding. Alphanumeric characters, hyphens, underscores, periods, and tildes can be used as-is.
What's the difference between percent encoding and Base64 encoding?
Percent encoding safely represents special characters within URLs, while Base64 converts binary data to text. They serve different purposes.

Put the terms to work

Shorten a URL for Free