seo.url_decode.how_desc
- seo.url_decode.how_step1
- seo.url_decode.how_step2
- seo.url_decode.how_step3
- seo.url_decode.how_step4
seo.url_decode.how_example
Decode URL encoded strings back to readable text.
URL decoding is the process of converting percent-encoded characters back to their original form. When data is URL encoded, special characters are replaced with % followed by hexadecimal values. This decoder reverses that process to restore the original text.
seo.url_decode.how_desc
seo.url_decode.how_example
URL decoding is the inverse of URL encoding (RFC 3986). The decoder processes the string character by character: when it encounters a % character followed by two hexadecimal digits, it converts those hex digits to a byte value and outputs the corresponding character. For UTF-8 encoded characters (which use multiple bytes), the decoder processes sequential %XX sequences to reconstruct the full character. For example, %C3%A9 decodes to é (UTF-8 bytes C3 A9). The decoder also handles the special case where + represents a space in form-encoded data (application/x-www-form-urlencoded).
Be cautious when decoding URLs from untrusted sources. Validate and sanitize decoded content before using it in your application to prevent injection attacks. Learn about encoding security
URL decoding is built into most programming languages. Here are comprehensive examples:
// urldecode() - decodes form encoding (+ becomes space)
$decoded = urldecode($encoded);
// rawurldecode() - RFC 3986 compliant (+ stays as +)
$decoded = rawurldecode($encoded);
// Parsing query strings (automatic decoding)
$url = 'https://example.com/search?q=coffee+%26+tea';
$parts = parse_url($url);
parse_str($parts['query'], $params);
// $params['q'] is automatically decoded: "coffee & tea"
// decodeURIComponent() - standard decoding (recommended)
const decoded = decodeURIComponent('hello%20world%20%26%20stuff');
// Result: "hello world & stuff"
// Handle plus signs manually if needed
function decodeFormData(str) {
return decodeURIComponent(str.replace(/\+/g, ' '));
}
// Parsing URL parameters
const url = new URL('https://example.com/search?q=coffee+%26+tea');
const query = url.searchParams.get('q');
// Automatically decoded: "coffee & tea"
from urllib.parse import unquote, unquote_plus, parse_qs
# unquote() - standard decoding (+ stays as +)
decoded = unquote('hello%20world%20%26%20stuff')
# Result: "hello world & stuff"
# unquote_plus() - form decoding (+ becomes space)
decoded = unquote_plus('hello+world+%26+stuff')
# Result: "hello world & stuff"
# Parsing query strings (automatic decoding)
params = parse_qs('q=coffee+%26+tea&page=1')
# params['q'] = ['coffee & tea']
import (
"net/url"
"fmt"
)
// QueryUnescape() - decodes query strings (+ becomes space)
decoded, err := url.QueryUnescape("hello+world+%26+stuff")
if err != nil {
fmt.Println("Decoding error:", err)
}
// Result: "hello world & stuff"
// PathUnescape() - decodes paths (+ stays as +)
decoded, err := url.PathUnescape("hello%2Fworld")
// Result: "hello/world"
// Parsing URL parameters (automatic)
u, _ := url.Parse("https://example.com/search?q=coffee+%26+tea")
query := u.Query().Get("q")
// Automatically decoded: "coffee & tea"
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
// URL decoding (always specify UTF-8)
try {
String decoded = URLDecoder.decode("hello+world+%26+stuff",
StandardCharsets.UTF_8);
// Result: "hello world & stuff"
} catch (Exception e) {
System.err.println("Decoding error: " + e.getMessage());
}
require 'uri'
require 'cgi'
# URI.decode_www_form_component() - form decoding
decoded = URI.decode_www_form_component('hello+world+%26+stuff')
# Result: "hello world & stuff"
# CGI.unescape() - alternative
decoded = CGI.unescape('hello+world')
# Result: "hello world"
# Parsing query strings (automatic)
params = URI.decode_www_form('q=coffee+%26+tea&page=1')
# params = [['q', 'coffee & tea'], ['page', '1']]
using System;
using System.Web;
using System.Net;
// HttpUtility.UrlDecode() - form decoding (+ becomes space)
string decoded = HttpUtility.UrlDecode("hello+world+%26+stuff");
// Result: "hello world & stuff"
// Uri.UnescapeDataString() - standard decoding (no System.Web)
string decoded = Uri.UnescapeDataString("hello%20world%20%26%20stuff");
// Result: "hello world & stuff"
Need to encode text for URLs? Use our URL Encoder to convert special characters to percent-encoded format.
Decoding Base64 strings? Try our Base64 Decoder for Base64-encoded data.
Decoding HTML entities? Use our HTML Entity Decoder to convert < > & back to characters.