How to Use URL Encoding and Decoding
URL encoding is essential for safely transmitting data in URLs. This guide explains what percent encoding is, why it matters, and how to use a free browser-based URL encoder and decoder.
Try the URL Encoder & DecoderWhat is URL Encoding?
URL encoding, commonly called percent encoding, represents characters using a percent sign (%) followed by two hexadecimal digits. For example, a space is encoded as %20 and a forward slash as %2F. This allows characters that are not allowed or that have special meaning in a URL to be safely transmitted.
Why Do URLs Need Encoding?
URLs can only contain a limited set of characters from the ASCII character set. Characters outside this set, and certain characters that have special meaning in URL syntax (such as ?, &, =, # and /), must be encoded when they are used as data rather than as structural delimiters.
For example, if a search query contains a space, the space must be encoded as %20 so the browser does not interpret it as the end of the URL path. Similarly, if a query value contains an ampersand (&), it must be encoded as %26 so it is not mistaken for a separator between parameters.
What is a URL Encoder?
A URL encoder converts text or URL components into a form suitable for use in URLs. It identifies characters that need encoding and replaces each with the appropriate percent-encoded sequence. A standards-compliant encoder uses UTF-8 as the underlying character encoding, so Unicode characters (including accented letters, CJK characters and emoji) are correctly handled.
What is a URL Decoder?
A URL decoder converts percent-encoded values back into their readable representation. It scans for %XX sequences and replaces each with the corresponding character. A standards-compliant decoder validates the input and reports errors for malformed percent sequences or invalid UTF-8.
URL Encoding vs Full URL Encoding
Encoding an entire URL as a single component can break its structure. For example, blindly percent-encoding:
https://example.com/search?q=hello world
would produce:
https%3A%2F%2Fexample.com%2Fsearch%3Fq%3Dhello%20world
This is rarely what you want. The colons, slashes, question mark and equals sign are structural characters that should be preserved. Full URL encoding mode parses the URL and only encodes the characters within each component that actually need encoding, preserving the structure:
https://example.com/search?q=hello%20world
Use URL Component mode for individual values and Full URL mode when you need to encode a complete URL while preserving its structure.
URL Encoding vs Query Parameter Encoding
Query parameter encoding (also called form-style or application/x-www-form-urlencoded encoding) follows slightly different rules from general URL component encoding. The most important difference is how spaces are handled:
- URL Component encoding: space becomes %20
- Query Parameter encoding: space becomes + (plus sign)
Both representations are valid in query strings, but the plus sign has a special meaning in form-style encoding. When decoding, the context matters: in query parameter mode, + is decoded as a space; in URL component mode, + is a literal plus sign.
What Does %20 Mean?
%20 is the percent-encoded representation of a space character. The 20 is the hexadecimal value of the ASCII code for space (32 in decimal). Whenever a space appears in a URL component that is not a query string using form-style encoding, it should be encoded as %20.
What Does %2F Mean?
%2F is the percent-encoded representation of a forward slash (/). When a forward slash is used as data (for example, in a path segment or a query value), it should be encoded as %2F so it is not mistaken for a path separator. In Full URL mode, forward slashes that are structural delimiters are preserved, while forward slashes that are data are encoded.
What is Double URL Encoding?
Double encoding happens when a value is encoded more than once. For example, a space is first encoded as %20. If that result is encoded again, the % itself is encoded as %25, producing %2520. This represents an encoded %20, not a space.
Double encoding is usually unintentional and can cause problems. This tool detects possible double encoding and warns you, but it never automatically decodes multiple times. If you see a warning, you can choose to decode again manually.
What is the Difference Between URL Encoding and Base64?
URL encoding and Base64 are both encoding schemes, but they serve different purposes:
- URL encoding makes text safe for use in URLs by encoding special characters as %XX sequences.
- Base64 encodes binary data as a string of ASCII characters so it can be transported through text-based systems.
URL encoding is reversible and does not change the data, only its representation for URL transport. Base64 is also reversible but is designed for binary data, not URL safety. See the Base64 Encoder & Decoder for Base64 encoding.
Does URL Encoding Provide Security?
No. URL encoding is not encryption and provides no confidentiality. Anyone with the encoded value can decode it instantly without a key. Do not use URL encoding to protect sensitive information. If you need security, use encryption and manage keys appropriately.
Privacy
This tool processes your URLs and query strings entirely in your browser. Your data is not sent to a server and is not included in analytics. Try the URL Encoder & Decoder now, or use the JSON Validator to validate and format JSON.
Try these tools
URL Encoder & Decoder
Encode and decode URLs, query parameters and special characters online. Percent-encode URL components with accurate UTF-8 support.
Use toolBase64 Encoder & Decoder
Encode text to Base64 or decode Base64 to text and files. Fast Base64 encoder and decoder with file support, validation, copy and download.
Use toolJSON Validator
Validate JSON online, find syntax errors, format and minify JSON with clear error messages and line and column information.
Use toolJSON Minifier
Minify JSON online by removing unnecessary whitespace while preserving your data. Validate, compress, copy and download compact JSON.
Use toolXML Formatter
Format and beautify XML online with proper indentation and readable structure. Validate, format, minify, copy and download XML.
Use toolFrequently asked questions
What is the difference between URL Component and Full URL encoding?+
URL Component encoding percent-encodes a single value, encoding all special characters. Full URL encoding parses the URL and only encodes characters within each component, preserving structural delimiters like :, /, ? and &.
What does %20 mean?+
%20 is the percent-encoded representation of a space. The 20 is the hexadecimal value of the ASCII code for space.
What is double URL encoding?+
Double encoding happens when a value is encoded more than once, producing sequences like %2520 which represents an encoded %20. This tool detects it and warns you without automatically decoding again.