URL เข้ารหัส / ถอดรหัส
เข้ารหัสหรือถอดรหัส URL และ query strings ด้วย percent-encoding
URL encoding คืออะไร?
อักขระที่ถูก encode ทั่วไป
URL รองรับได้เฉพาะอักขระบางชุดเท่านั้น เมื่อคุณต้องการใส่ช่องว่าง เครื่องหมายวรรคตอน หรืออักขระที่ไม่ใช่ ASCII (เช่น ₹ หรือ 中文) ใน URL อักขระเหล่านั้นต้องถูก percent-encode — แทนที่ด้วย %XX โดย XX คือค่า hex ของอักขระนั้น
เครื่องมือนี้ใช้ encodeURIComponent และ decodeURIComponent — ฟังก์ชันเดียวกับที่เบราว์เซอร์และ JavaScript ใช้ภายใน รองรับ Unicode, emoji และอักขระหลายไบต์ได้อย่างถูกต้อง
นักพัฒนา frontend ทำการ encode ค่า query parameter ก่อนนำไปต่อกับ API endpoint — คำค้นหาอย่าง "price ≥ ₹500" จะกลายเป็น price+%E2%89%A5+%E2%82%B9500 เมื่อส่งเป็น URL parameter วิศวกร backend ทำการ decode query string ที่รับเข้ามาเพื่อดึงค่าที่ผู้ใช้ส่งมาก่อนประมวลผล ทีมคอนเทนต์ที่สร้าง URL ที่ติด UTM tag จะ encode ชื่อแคมเปญที่มีช่องว่างและอักขระพิเศษ Web scraper ทำการ decode URL ที่ถูก percent-encode จาก sitemap เพื่อกู้คืน path ของหน้าที่อ่านได้
ใช้ encodeURI เมื่อ encode URL ทั้งหมด — มันรักษาอักขระโครงสร้างอย่าง /, ?, =, และ & เอาไว้ เพื่อให้ URL ยังคงทำงานได้ ใช้ encodeURIComponent เมื่อ encode ค่า query parameter เดี่ยว — มันจะ encode ทุกอย่างรวมถึง / และ & เพื่อให้ค่านั้นไม่สามารถทำลายโครงสร้าง URL ได้ เครื่องมือนี้ใช้ encodeURIComponent ซึ่งเป็นค่าเริ่มต้นที่ปลอดภัยสำหรับค่า parameter หากคุณต้องการ encode URL เต็มโดยไม่ทำลายโครงสร้าง ให้ใช้ encodeURI แทน ซึ่งสามารถใช้ได้ใน browser console ทุกตัว
เมื่อคุณคัดลอก URL จาก address bar ของเบราว์เซอร์หรือ API response แล้วเห็นลำดับอักขระอย่าง %E2%82%B9 ให้วางลงใน decoder เพื่อดูข้อความต้นฉบับ (₹ ในกรณีนี้) Email client และ CMS บางตัวทำ double-encode URL โดยเปลี่ยน %20 เป็น %2520 — decode สองครั้งเพื่อกู้คืนต้นฉบับ log file จาก web server มักเก็บ request path แบบ percent-encode ดิบๆ ใช้เครื่องมือนี้ decode ให้อ่านได้เมื่อ debug ข้อผิดพลาด 404 ที่เกิดจากอักขระพิเศษใน file path
- Space → %20
- & → %26
- = → %3D
- ? → %3F
- / → %2F
- # → %23
- + → %2B
คำถามที่พบบ่อย
- What is URL encoding?
- URL encoding (also called percent-encoding) converts characters that aren't allowed in a URL into a safe format. Each unsafe character is replaced with a % sign followed by two hex digits. For example, a space becomes %20, and & becomes %26.
- When do I need to encode a URL?
- Whenever you include user input or special characters in a URL — query parameters, path segments, or form data. Characters like spaces, &, =, ?, #, and non-ASCII text (like ₹ or Hindi script) must be encoded to avoid breaking the URL structure.
- What's the difference between encodeURI and encodeURIComponent?
- encodeURI encodes a full URL and leaves structural characters like / ? & = intact. encodeURIComponent (what this tool uses) encodes everything except letters, digits, and - _ . ! ~ * ' ( ) — making it safe for individual query parameter values.
- Is my data sent to a server?
- No. Encoding and decoding happen in your browser using JavaScript's built-in encodeURIComponent and decodeURIComponent functions. Nothing is uploaded.
เครื่องมือที่เกี่ยวข้อง
- JSON Formatter, Validator & Repair Tool
Format, minify, validate, and repair JSON instantly in your browser. Sort keys alphabetically, auto-format on paste, download as file, escape/unescape strings — free, no sign-up, 100% client-side.
- ตัวสร้าง QR Code
สร้าง QR code สำหรับ URL ข้อความ Wi-Fi และอื่นๆ ดาวน์โหลดเป็น PNG
- ตัวสร้างรหัสผ่าน
สร้างรหัสผ่านสุ่มที่แข็งแกร่งด้วยความยาวและชุดอักขระที่กำหนดเอง
- Base64 เข้ารหัส / ถอดรหัส
เข้ารหัสข้อความเป็น Base64 หรือถอดรหัสกลับเป็นข้อความธรรมดา
- ตัวสร้างแฮช
สร้างแฮช SHA-1, SHA-256, SHA-384 และ SHA-512 ได้ทันที