DevToolBox

URL Encoder / Decoder

URLの特殊文字をパーセントエンコード・デコードします。Unicode対応。

How to Use the URL Encoder / Decoder

This free URL encoding tool converts special characters in text to their percent-encoded equivalents, making them safe for use in URLs. It can also decode percent-encoded strings back to readable text. All processing is done locally in your browser.

What is URL Encoding?

URL encoding (also called percent-encoding) replaces unsafe characters with a percent sign followed by two hexadecimal digits. For example, a space becomes %20, and an ampersand becomes %26. This ensures that URLs are transmitted correctly across the internet without ambiguity.

When Do You Need URL Encoding?

URL encoding is necessary whenever you include user input in URLs, pass special characters as query parameters, build API request URLs programmatically, or encode file names that contain spaces or special characters. Without proper encoding, URLs may break or be interpreted incorrectly by web servers.

Characters That Need Encoding

Reserved characters like ?, &, =, #, and / have special meaning in URLs and must be encoded when used as data. Unsafe characters such as spaces, quotes, and angle brackets should always be encoded. This tool handles all of these automatically using the standard encodeURIComponent function.

URLエンコーダー/デコーダーの使い方

「エンコード」または「デコード」モードを選択し、テキストを入力してボタンを押すだけでURLエンコード・デコードができます。 スペースや特殊文字、日本語などのUnicode文字も正しく処理されます。APIのクエリパラメータ作成やURLデバッグに便利です。 全ての処理はブラウザ内で完結し、データが外部に送信されることはありません。

よくあるエラーと対処 / Common Errors and Fixes

エラー / Error原因 / Cause対処 / Fix
encodeURI と encodeURIComponent の混同
encodeURI vs encodeURIComponent mix-up
encodeURI は / ? & = をエンコードしないため、パラメータ値に使うと構造が壊れる
encodeURI leaves / ? & = untouched, corrupting parameter values
クエリの値には必ず encodeURIComponent を使う
Always use encodeURIComponent for parameter values
+ がスペースにならない/なる
Plus sign vs space confusion
+ をスペースと解釈するのは application/x-www-form-urlencoded のみ。パスでは + は + のまま
Only form encoding maps + to space; in paths + is literal
スペースは %20 でエンコードするのが安全。フォームデコード時のみ + → スペース変換
Encode spaces as %20; translate + only when decoding form data
URIError: malformed URI sequence
URIError on decode
% の後に有効な16進2桁がない(%が生のまま含まれる、または切り詰められたURL)
A % not followed by two hex digits — raw % or truncated URL
% 自体は %25 にエンコードされているか確認。途中で切れたURLは元を取得し直す
Ensure literal % is %25; re-fetch truncated URLs
二重エンコード
Double encoding
%20 が %2520 になる等。エンコード済み文字列を再エンコードした
%20 becomes %2520 when an encoded string is encoded again
「受け取ったら即デコード、送る直前に1回だけエンコード」を徹底
Decode at the boundary in, encode exactly once on the way out
日本語ドメインが変換されない
Japanese domains not converting
ドメイン名はパーセントエンコードではなく Punycode(xn--)を使う
Hostnames use Punycode (xn--), not percent-encoding
URL API(new URL())に任せるとホスト名は自動で Punycode 化される
Let the URL API handle hostname conversion

言語別コード例 / Code Examples

JavaScript

encodeURIComponent("東京&大阪")  // "%E6%9D%B1%E4%BA%AC%26%E5%A4%A7%E9%98%AA"
decodeURIComponent("%E6%9D%B1%E4%BA%AC")  // "東京"
// URLSearchParams なら自動でエンコードされる
new URLSearchParams({ q: "東京&大阪" }).toString()

Python

from urllib.parse import quote, unquote, urlencode
quote("東京&大阪", safe="")        # 値のエンコード
urlencode({"q": "東京&大阪"})       # クエリ文字列の組み立て

Shell (curl)

curl -G --data-urlencode "q=東京 大阪" https://example.com/search
# --data-urlencode が自動でエンコードしてくれる

Go

import "net/url"
url.QueryEscape("東京&大阪")   // クエリ値用
url.PathEscape("東京/大阪")    // パスセグメント用(/もエンコード)

変換例 / Before & After

"hello world"   → "hello%20world"
"東京"           → "%E6%9D%B1%E4%BA%AC"  (UTF-8の3バイトを%表記)
"a&b=c"         → "a%26b%3Dc"           (構造文字のエスケープ)
"100%"          → "100%25"              (%自体は%25)

Why browser-only?

URLs frequently embed sensitive data: session tokens, API keys in query strings, internal hostnames, or user identifiers. Pasting them into a server-backed encoder hands all of that to a third party. This tool uses the browser's built-inencodeURIComponent/decodeURIComponent — every conversion happens on your machine, nothing is transmitted, and it works offline. Verify in the DevTools Network tab.

URLにはセッショントークンやAPIキーが含まれがちです。本ツールは変換の全てがブラウザ内で完結し、 入力したURLが外部に送信されることはありません。

開発をもっと効率的に

PR