Skip to main content
miji.be

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.

May 1, 2026 / About 1 min read

URL Shortening

URL encoding, also known as percent encoding, is the process of converting characters that are not allowed in URLs into a universally accepted format. Special characters, spaces, and non-ASCII characters are replaced with a percent sign followed by two hexadecimal digits representing the character's ASCII or UTF-8 byte value. For example, a space becomes "%20" and an ampersand becomes "%26."

URL encoding is defined by RFC 3986, which specifies which characters are allowed in different parts of a URL. Unreserved characters (A-Z, a-z, 0-9, hyphen, period, underscore, tilde) can appear as-is, while reserved characters that have special meaning in URL syntax must be encoded when used as data rather than delimiters.

In URL shortening, encoding is relevant in two contexts. First, the destination URL submitted for shortening may contain encoded characters that must be preserved during storage and redirect. Second, the short URL itself should avoid characters that require encoding, which is why most services restrict short codes to alphanumeric characters and hyphens.

Common pitfalls include double encoding (encoding an already-encoded URL), inconsistent encoding of Unicode characters, and failing to encode query parameter values. These issues can cause broken redirects or incorrect destination pages.

Was this article helpful?

Related Terms

Short URL

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

URL Slug

The human-readable portion of a URL that identifies a specific page, typically derived from the page title.

Percent-Encoding

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

QR Code Encoding

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

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.

URL Fragment

The portion of a URL after the "#" symbol. Used for direct links to specific page sections and for SPA routing.

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

When is URL encoding necessary?
When URLs contain non-ASCII characters (like Japanese), spaces, or special characters (&, =, ?, etc.). Browsers handle encoding automatically, but explicit encoding is needed when building URLs programmatically.
What's the difference between URL encoding and decoding?
Encoding converts characters to percent notation (%XX), while decoding converts percent notation back to original characters. For example, spaces become %20 when encoded.

Put the terms to work

Shorten a URL for Free