CalcSutra

URL Encode / Decode

URL encode special characters for safe use in web addresses. Decode URL-encoded strings back to readable text. Encode special characters in URLs for safe web transmission. Decode encoded URLs back to readable text for web development work.

Enter Values

Fill in the fields and press Calculate to see instant results.

URL Encoder & Decoder (Percent-Encoding)

URLs are fragile. Because the infrastructure of the internet was built on the standard ASCII character set, web addresses simply cannot contain spaces, emojis, foreign language characters, or certain symbols. If you try to pass these characters in a URL, the link will break. Our free URL Encoder/Decoder instantly converts unsafe text into safe, percent-encoded strings ready for use in web development and API requests.

This tool runs entirely in your browser. Whether you are debugging a complex REST API payload, constructing affiliate tracking links, or fixing broken href tags, your data is processed locally and never sent to a server.

πŸ’‘ Developer Tip: The most common URL bug is failing to encode the ampersand (&) when it is part of your data (like a company name: "AT&T"). If unencoded, the web server will interpret the & as the start of a new query parameter, completely corrupting your data. AT&T must be encoded as AT%26T.

When to Use This URL Encoder

πŸ”— Constructing Query Parameters

When appending user input to a URL (e.g., ?search=user input), you must encode it to ?search=user%20input to ensure the browser routes it correctly.

🐞 Debugging API Requests

Paste massive, unreadable URL strings from your network tab into the Decoder to easily read the JSON or parameter data being passed between the frontend and backend.

πŸ“± Appending UTM Tracking Codes

Marketers building UTM tracking links must ensure that campaign names containing spaces or special symbols are properly percent-encoded before launching ad campaigns.

πŸ“§ Building mailto: Links

If you want an HTML link to open an email client with a pre-filled subject and body, the subject and body text must be strictly URL encoded.

🌍 Handling Internationalization

URLs containing non-English characters (like Arabic, Cyrillic, or Chinese) must be UTF-8 encoded and then URL percent-encoded for global compatibility.

πŸ—„οΈ Database ID Routing

If your database uses string IDs that happen to contain slashes or plus signs, they will break your REST API routes (e.g., /users/id/name) unless properly encoded.

URL Encoding Formula & Rules

URL encoding (officially defined in RFC 3986) divides all characters into two buckets: Reserved and Unreserved.

Unreserved Characters (Never Encode)

These characters are safe. The encoder will ignore them:

A-Z, a-z, 0-9, hyphen (-), underscore (_), period (.), tilde (~)

Reserved Characters (Must Encode If Used as Data)

These characters have structural meaning in a URL. If you want to use them as actual text data, you MUST encode them.

CharacterMeaning in URLEncoded Value
SpaceInvalid character%20
!Reserved%21
#Fragment identifier (anchor)%23
$Reserved%24
%Escape character%25
&Query parameter separator%26
+Often implies Space in query strings%2B
/Path separator%2F
:Scheme separator (http:)%3A
?Start of query string%3F
=Query key/value separator%3D

5 Worked Examples

Example 1: Basic Search Query

User Input (Search Box):

New York Pizza

Encoded URL:

https://example.com/search?q=New%20York%20Pizza

Note: The spaces are replaced with %20. Without this, the URL breaks after "New".

Example 2: The Ampersand Danger

Company Name Data:

Barnes & Noble

Properly Encoded URL:

?company=Barnes%20%26%20Noble

The Danger: If you don't encode it (?company=Barnes & Noble), the server thinks you are sending two parameters: company=Barnes and a second parameter named Noble with no value.

Example 3: Passing URLs inside URLs

Sometimes you need to pass a redirect URL as a parameter.

Redirect Target: https://google.com/search?q=cats

Properly Encoded Full URL:

https://myapp.com/login?redirect=https%3A%2F%2Fgoogle.com%2Fsearch%3Fq%3Dcats

Notice how the colons, slashes, question marks, and equals signs of the target URL must ALL be encoded so they don't interfere with the main app's URL structure.

Example 4: Pre-filling Emails with mailto:

Desired Subject/Body:

Subject: Hello World!
Body: 100% ready.

Encoded Href Attribute:

mailto:admin@site.com?subject=Hello%20World%21&body=100%25%20ready.

The exclamation point becomes %21, and the percent sign itself must be encoded to %25.

Example 5: Emojis in URLs

User Input:

I ❀️ Code

Encoded String:

I%20%E2%9D%A4%EF%B8%8F%20Code

Emojis are multibyte UTF-8 characters. The encoder converts the heart emoji into its raw byte representation and percent-encodes each individual byte.

Frequently Asked Questions

β–ΆWhat is URL Encoding (Percent-Encoding)?
URL encoding converts unsafe characters (like spaces or symbols) into a safe ASCII format so they can be transmitted over the internet within a URL. It uses a percent sign followed by two hexadecimal digits.
β–ΆWhy do spaces become %20 in URLs?
In the ASCII standard, the space character has the hexadecimal value of 20. Therefore, percent-encoding replaces it with %20. In HTML form data, spaces are sometimes encoded as a plus (+).
β–ΆWhat are 'Reserved' characters?
Characters like ?, &, #, /, and = are reserved because they define the structure of a URL. If you want to use them as actual text data in your URL, you must encode them so the browser doesn't misinterpret them.
β–ΆIs URL encoding the same as Base64?
No. Base64 is used to convert entire files or binary data into a text block. URL encoding is specifically used to make short text strings safe for placement inside a web address.
β–ΆIs URL encoding different from HTML encoding?
Yes. URL encoding uses percent signs (e.g., %20) for web addresses. HTML encoding uses ampersands (e.g., <) to display symbols on a web page safely.
β–ΆWhy did my string become %2520?
You 'double-encoded' your text. The space became '%20', and then the encoder encoded the '%' sign itself into '%25', resulting in '%2520'. Only encode raw data once.

Related Developer Tools

People Also Calculate

Calculators visitors commonly use alongside this one.