Декодирование URL-кодированных строк обратно в читаемый текст.
Что такое декодирование URL?
Декодирование URL — это процесс преобразования процентно-кодированных символов обратно в их исходную форму. Когда данные закодированы в URL, специальные символы заменяются на % с последующими шестнадцатеричными значениями. Этот декодер выполняет обратный процесс для восстановления исходного текста.
Common Uses of URL Decoding
- Reading Query String Parameters: When analyzing URLs from browser address bars, analytics, or logs, query parameters are often URL-encoded. To understand what values users searched for or what filters they applied, decode the parameters. For example, ?q=coffee+%26+tea decodes to "coffee & tea". Web frameworks automatically decode parameters, but when working with raw URLs or building custom parsers, you must decode manually.
- Server Log Analysis: Web server logs (Apache, Nginx) record URLs with percent-encoding intact. When analyzing access logs to find popular search terms, detect attack patterns, or debug 404 errors, decode URLs to see what users actually requested. For example, /search?q=%22hello+world%22 decodes to /search?q="hello world".
- Debugging Web Applications: During development, inspect URLs in your browser's developer tools network tab. Encoded parameters can be hard to read. Decoding them helps you verify that your application is sending correct data. This is especially useful for complex URLs with multiple encoded parameters, nested objects, or JSON strings passed as URL parameters.
- API Development and Testing: When building or testing APIs that accept URL parameters, decode incoming parameters to validate that clients are sending correct data. This helps diagnose issues where parameter values are double-encoded, incorrectly encoded, or contain unexpected characters. API testing tools like Postman show encoded URLs. Decoding helps verify the actual values being sent.
Как использовать этот декодер URL
seo.url_decode.how_desc
- Вставьте вашу URL-кодированную строку в поле ввода выше.
- Нажмите кнопку "Декодировать URL".
- Декодированный результат появится в поле вывода.
- Используйте кнопку "Копировать результат", чтобы скопировать декодированный текст.
seo.url_decode.how_example
Understanding URL Decoding
Кодирование URL было стандартизировано в RFC 3986 (2005), который определяет синтаксис для универсальных идентификаторов ресурсов (URI). Стандарт указывает, какие символы безопасны (A-Z, a-z, 0-9, -, _, ., ~), а какие должны быть процентно-кодированы. До RFC 3986 различные системы использовали разные методы, что приводило к проблемам совместимости.
Security Considerations When Decoding URLs
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 в языках программирования
Декодирование URL встроено в большинство языков программирования. Вот примеры:
// 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"
Related Tools
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.