Przejdź do treści głównej
FreeOnlineTools Go
Polski
how-to

Jak Kodować i Dekodować URL-e: Kompletny Przewodnik

By FreeOnlineTools Team · Updated 2026-08-28

Quick Answer

Kodowanie URL konwertuje unsafe znaki na sekwencje %XX gdzie XX to hex wartość bajtu. Spacje stają się %20 (lub + w form data), chińskie znaki stają się multi-byte sekwencjami %XX. Użyj naszego darmowego URL Encoder i URL Decoder —całe przetwarzanie lokalnie.

Introduction

Kodowanie URL, nazywane też percent-encoding, to mechanizm kodowania reserved i unsafe znaków w URL tak, aby URL mógł być bezpiecznie transmitowany przez internet. URLe mogą zawierać tylko ograniczony zestaw znaków ASCII; każdy inny znak (spacje, nie-ASCII litery, symbol) musi być percent-zakodowany jako sekwencja zaczynająca się od % po której następują dwie cyfry hex.

Step by Step

  1. Identify what needs encoding

    Characters that are not in the unreserved set (A-Z, a-z, 0-9, -, ., _, ~) must be percent-encoded. This includes spaces, query separators like = and &, slashes, and all non-ASCII characters such as Chinese, Arabic, or emoji.

  2. Encode the URL or query string

    Paste your text into the URL Encoder tool. It uses encodeURIComponent() to encode every reserved character. The result appears instantly in the output field.

  3. Copy the encoded result

    Click the Copy button to copy the percent-encoded string. You can now safely embed it in a URL query parameter, API request, or form submission.

  4. Decode an encoded URL

    Paste an encoded URL or query string into the URL Decoder tool. It uses decodeURIComponent() to restore the original characters. Verify the decoded output matches your expectation.

  5. Verify edge cases

    Check that spaces are decoded correctly (%20 vs +), that multi-byte UTF-8 sequences decode to the right character, and that already-encoded strings are not double-encoded.

Examples

Encode text with a space

Input: Hello World

Output: Hello%20World

Encode a path separator

Input: a/b

Output: a%2Fb

Encode Chinese characters (UTF-8)

Input: 你好

Output: %E4%BD%A0%E5%A5%BD

Decode an encoded query parameter

Input: key%3Dvalue%26foo%3Dbar

Output: key=value&foo=bar

Common Problems

  • Double-encoding: encoding an already-encoded string turns %20 into %2520. Always check whether input is already encoded before re-encoding.
  • Confusing encodeURI with encodeURIComponent: encodeURI keeps reserved characters like /, ?, & intact for full URLs, while encodeURIComponent encodes everything for query parameter values.
  • Space handling: %20 is the percent-encoded form; + is only valid in application/x-www-form-urlencoded body data, not in URL path or query string per RFC 3986.
  • Non-UTF-8 legacy encodings: modern browsers encode as UTF-8, but legacy systems may use GBK or Latin-1, causing mojibake when decoded on the other side.

Tips

  • Use encodeURIComponent() for individual query parameter values, and encodeURI() for entire URLs that are already well-formed.
  • When building query strings, encode the value but not the = or & separators —encode each value separately then join with &.
  • Use our URL Encoder and Decoder tools to debug API calls that return 400 errors due to malformed query strings.
  • Always decode on the server side using the same character encoding (UTF-8) to avoid mojibake.

Related Tools

Related Guides

References