ToolNestr

URL Encoder / Decoder

Paste a URL or text to encode it for safe URL transmission, or paste an encoded URL to decode it back.

Reviewed by the ToolNestr Editorial Team — July 2026

How URL encoding works

URL encoding, also known as percent-encoding, replaces unsafe or reserved characters in a URL with a percent sign (%) followed by two hexadecimal digits representing the character's ASCII code. This ensures that characters with special meaning in URLs (like ?, &, #, and space) are transmitted safely without breaking the URL structure.

The tool uses JavaScript's encodeURIComponent() for encoding, which is the correct function for encoding query parameter values as it encodes everything including characters like :, /, and ?. For decoding, it handles both percent-encoded sequences and plus signs (which represent spaces in form-encoded application/x-www-form-urlencoded data).

Worked example

Input: "Hello World!"
Encoded: "Hello+World%21" (space → +, ! → %21)
URL Percent-Encoding Diagram A URL string with special characters highlighted and their percent-encoded equivalents shown below https://example.com/search? q = hello world & cat = dog %22hello+world%22 %22dog%22 Encoded result: https://example.com/search?q=%22hello+world%22&cat=%22dog%22 Spaces and special characters are percent-encoded for safe URL transmission
Special characters in query parameters are percent-encoded so the URL remains valid

Characters that need URL encoding

How frequently each character requires percent-encoding in real-world URLs.

Space → %2035% of encoding
& → %2620%
= → %3D15%
# → %2312%
% → %2510%
Other chars (+/?@$)8%
👩‍💻

Aisha Kapoor

Web developer who encodes user-generated content before appending it to query strings and decodes incoming URL parameters for display on pages.

🔗

David Okonkwo

API integrator who encodes payloads and query parameters when hitting third-party REST endpoints, ensuring special characters do not break the request.

📢

Sarah Mitchell

Marketer who builds UTM-tracked campaign URLs and needs to encode spaces and special characters so analytics tools parse them correctly.

🔍

Carlos Mendez

QA tester who decodes obfuscated URLs to verify redirect logic and checks that encoded parameters survive round-trip through the application.

CharacterEncodedWhy it needs encoding
space%20Not allowed in URLs
!%21Reserved character
#%23Fragment identifier start
$%24Reserved character
%%25Percent-encoding indicator
&%26Query separator
+%2BRepresents space in form data
,%2CReserved character
/%2FPath separator
:%3AScheme/port separator
;%3BReserved character
=%3DKey-value separator
?%3FQuery string start
@%40User-info separator

How to use URL Encoder / Decoder

1

Paste your text

Type or paste the text, URL, or query parameter you want to encode or decode into the input area.

2

Choose direction

Click Encode to percent-encode special characters, or Decode to convert percent-encoded sequences back to their original form.

3

Copy the result

Use the Copy button to grab the output. The analysis section shows exactly which characters were encoded or decoded.

Tips for URL encoding

Always encode query parameter values

When building URLs dynamically, always use encodeURIComponent() on parameter values to prevent &, =, and # from breaking the URL structure. A single unencoded & can split your query string.

Do not encode the entire URL

Use encodeURI() for the full URL (preserves ://?#) and encodeURIComponent() only for individual parameter values. Encoding the full URL with encodeURIComponent() will break the scheme and path separators.

Avoid double encoding

If you encode a string that is already percent-encoded, the % characters become %25, creating double encoding. Most servers will not decode %2520 back to a space. Check before encoding.

What is URL encoding?

URL encoding, also known as percent encoding, is a mechanism for translating characters that have special meaning in URLs into a safe, universally accepted format. Each character is replaced by a percent sign followed by two hexadecimal digits representing its byte value. For example, the space character (ASCII 32) becomes %20. This ensures that URLs remain valid across the internet regardless of the characters they contain.

Why it is needed

URLs have a restricted character set defined by RFC 3986. Characters like &, ?, #, and space have reserved purposes within the URL syntax. Without encoding, a user searching for "cats & dogs" would produce a URL where & splits the query string prematurely. URL encoding prevents these ambiguities by converting problematic characters into a safe representation that servers and browsers can reliably parse.

encodeURI vs encodeURIComponent

JavaScript provides two functions for URL encoding. encodeURI() is designed to encode a complete URI while leaving characters like ://?#/ intact so the URL remains functional. encodeURIComponent() is more aggressive and encodes those characters as well, making it the correct choice for encoding individual query parameter values. Using encodeURI() on a parameter value will not encode the & or = characters, potentially breaking the URL.

Common pitfalls

One common mistake is forgetting to encode user input before inserting it into a URL, leading to broken links or security vulnerabilities. Another is double encoding by encoding an already-encoded string. Developers also confuse URL encoding with HTML encoding — they serve different purposes. Finally, some characters like + have special meaning (space alternative in query strings), so encoding them appropriately is important for correct behavior.

Frequently asked questions

What is URL encoding?

URL encoding (percent encoding) replaces special characters in a URL with a percent sign (%) followed by two hexadecimal digits representing the character's ASCII code. For example, a space becomes %20.

Why are spaces encoded as %20?

Spaces are not allowed in URLs. The ASCII code for space is 32 decimal, which is 20 in hexadecimal, so it is encoded as %20. Modern browsers may display %20 as a space, but the actual URL contains %20.

What is the difference between encodeURI() and encodeURIComponent()?

encodeURI() encodes a full URI while preserving characters that are part of the URI syntax (:, /, ?, #). encodeURIComponent() encodes everything including those characters, making it suitable for encoding query parameter values.

When should I use encodeURIComponent()?

Always use encodeURIComponent() when encoding the value of a query parameter. If a user types "hello world & more" into a search box, encodeURIComponent() will safely encode the spaces and the & character.

What characters need encoding in a URL?

Characters like space, &, ?, #, %, =, +, @, $, and non-ASCII characters all need encoding. Only letters, digits, and the characters - _ . ~ are always safe in URLs.

Can I put a URL with Chinese or Arabic characters in a browser?

Modern browsers automatically encode non-ASCII characters in the address bar. However, the underlying protocol requires them to be percent-encoded. This tool helps you see what the browser is doing behind the scenes.

Is URL encoding the same as HTML encoding?

No. URL encoding uses % followed by hex digits (e.g., %20 for space). HTML encoding uses entity names or numbers (e.g.,   for non-breaking space). They serve different purposes in different contexts.

Why does my URL break when I include & in a query parameter?

The & character is used to separate query parameters. If your parameter value contains &, it must be encoded as %26 so the URL parser does not treat it as a parameter separator.

What happens if I double-encode a URL?

If you encode an already-encoded URL, the % characters themselves get encoded to %25. For example, %20 becomes %2520. Most servers will not decode this correctly, so avoid encoding more than once.

How can I tell if a string is already URL-encoded?

Look for % followed by two hexadecimal digits. However, not every % sequence guarantees valid encoding. The safest approach is to decode first, then re-encode when needed.

All tool categories

Converters (69 tools)
📊 CSV ↔ JSON Converter📄 JSON ↔ YAML Converter🔀 JSON ↔ XML Converter💿 Text ↔ Binary Converter🔢 Text ↔ Hex Converter🔗 URL Encoder / Decoder🏷️ HTML Entity Converter📡 Morse Code Converter💻 ASCII Code Converter🔤 Regex Escaper / Unescaper📄 GSM to mm Calculator💾 Data Storage Converter📡 Data Transfer Rate Converter⛽ Fuel Economy Converter📏 Feet & Inches Calculator📐 Inches to Fraction Calculator⚖️ Kg to Lbs Converter⚖️ Lbs to Kg Converter⚖️ Kg to Stone Converter⚖️ Stone to Kg Converter⚖️ Grams to Ounces Converter⚖️ Ounces to Grams Converter⚖️ Grams to Pounds Converter⚖️ Pounds to Grams Converter⚖️ Mg to Grams Converter⚖️ Metric Tons to Kg Converter📏 Cm to Inches Converter📏 Inches to Cm Converter📏 Cm to Feet Converter📏 Feet to Cm Converter📏 Mm to Inches Converter📏 Inches to Mm Converter📏 Meters to Feet Converter📏 Feet to Meters Converter📏 Km to Miles Converter📏 Miles to Km Converter📏 Yards to Meters Converter📏 Feet to Inches Converter📏 Inches to Feet Converter📏 Nautical Miles to Km Converter🌡️ Celsius to Fahrenheit Converter🌡️ Fahrenheit to Celsius Converter🌡️ Celsius to Kelvin Converter🌡️ Kelvin to Celsius Converter🧪 Liters to Gallons (US) Converter🧪 Gallons (US) to Liters Converter🧪 Ml to Fluid Ounces (US) Converter🧪 Fluid Ounces to Ml Converter🧪 Cups (US) to Ml Converter🧪 Quarts to Liters Converter🏎️ Mph to Km/h Converter🏎️ Km/h to Mph Converter🏎️ Knots to Mph Converter🔧 Psi to Bar Converter🔧 Bar to Psi Converter📏 Length Converter⚖️ Weight Converter📐 Area Converter🧪 Volume Converter🏎️ Speed Converter🔧 Pressure Converter⚡ Energy Converter🔌 Power Converter📐 Angle Converter🔢 Number to Words Converter🔢 Words to Numbers Converter➗ Decimal to Fraction Converter➗ Fraction to Decimal Converter🔬 Scientific Notation Converter
🌐 Networking & IP Tools (36 tools)
🧮 Everyday (26 tools)
💪 Health & Fitness (30 tools)
💰 Finance (34 tools)
🔢 Math (23 tools)
📄 PDF Tools (10 tools)
🎨 Creators (12 tools)
💻 Developers (24 tools)
⚡ Engineering & Science (24 tools)
⚛️ Physics (48 tools)
🧪 Chemistry (50 tools)
🧬 Biology (50 tools)
🏠 Construction & Home Improvement (105 tools)
👗 Clothing & Garment Tools (68 tools)
🍳 Cooking & Baking (9 tools)
🚗 Automotive (26 tools)
🖼️ Image Tools (13 tools)
🔐 Security & Hash (15 tools)
📝 Text Tools (15 tools)
🔍 SEO Tools (11 tools)
🕐 Time & Date (15 tools)
📊 Chart Generators (11 tools)
🕌 Islamic Tools (16 tools)