Декодування 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.