What is URL encoding?
A URL may only contain a limited set of ASCII characters. Anything else — spaces, Bangla letters, emoji, or characters that already have a job in a URL such as &, =, ? and # — has to be written as a percent-encoded sequence: each byte of the character’s UTF-8 form becomes % followed by two hex digits. A space becomes %20, and the Bangla letter ক becomes %E0%A6%95. Decoding reverses the process.
Component or full URL?
- Component (
encodeURIComponent) encodes everything except letters, digits and- _ . ! ~ * ' ( ). Use it for a single value you are putting into a query string or path segment — a search term, a redirect URL, a file name. - Full URL (
encodeURI) leaves the URL’s structure alone (: / ? # & =) and only encodes characters that are never allowed, like spaces and non-ASCII text. Use it to clean up a whole address someone typed.
A classic bug is encoding a whole URL with the component function (the :// turns into %3A%2F%2F), or building a query string with the full-URL function, so an & inside a value silently splits it into two parameters.
What about “+”?
HTML forms submit data as application/x-www-form-urlencoded, where a space is written as + instead of %20. Turn on “+ means space” when you decode form data or query strings produced by forms; leave it off for ordinary paths, where a + is just a plus sign.
FAQ
Why do I get a “malformed” error?
The text contains a % that is not followed by two hex digits (like 100%), or a byte sequence that is not valid UTF-8 — often text that was encoded with an old Latin-1 encoder. The tool shows where the problem is and still decodes the rest.
How are repeated query keys handled?
The parser lists every occurrence in order, as ?tag=a&tag=b is valid and common. Repeated keys are marked so you can spot them quickly.
Is the URL sent anywhere?
No. Everything is processed in your browser with the built-in URL API; nothing is fetched or uploaded.
URL এনকোডিং কী?
একটি URL-এ শুধু নির্দিষ্ট কিছু ASCII অক্ষর থাকতে পারে। বাকি সবকিছু — স্পেস, বাংলা বর্ণ, ইমোজি, কিংবা URL-এ যেসব অক্ষরের আগে থেকেই বিশেষ কাজ আছে যেমন &, =, ? ও # — লিখতে হয় পার্সেন্ট-এনকোড করে: অক্ষরটির UTF-8 রূপের প্রতিটি বাইট হয়ে যায় % এবং তার পরে দুটি হেক্স অঙ্ক। যেমন স্পেস হয় %20, আর বাংলা ক হয় %E0%A6%95। ডিকোড করলে এর উল্টোটা হয়।
কম্পোনেন্ট নাকি পুরো URL?
- কম্পোনেন্ট (
encodeURIComponent) অক্ষর, অঙ্ক এবং- _ . ! ~ * ' ( )ছাড়া সবকিছু এনকোড করে। কুয়েরি স্ট্রিং বা পাথের একটি মান — যেমন সার্চের শব্দ, রিডাইরেক্ট URL বা ফাইলের নাম — বসানোর সময় এটি ব্যবহার করুন। - পুরো URL (
encodeURI) URL-এর কাঠামো (: / ? # & =) অক্ষত রাখে, শুধু যেসব অক্ষর কখনোই চলে না (স্পেস, বাংলা ইত্যাদি) সেগুলো এনকোড করে। কেউ টাইপ করা পুরো ঠিকানা ঠিকঠাক করতে এটি কাজে লাগে।
একটি প্রচলিত ভুল হলো পুরো URL-কে কম্পোনেন্ট ফাংশন দিয়ে এনকোড করা (তখন :// হয়ে যায় %3A%2F%2F), অথবা পুরো-URL ফাংশন দিয়ে কুয়েরি স্ট্রিং বানানো — তাতে কোনো মানের ভেতরের & চুপচাপ সেটিকে দুটি প্যারামিটারে ভাগ করে ফেলে।
“+” চিহ্নের ব্যাপারটা কী?
HTML ফর্ম ডেটা পাঠায় application/x-www-form-urlencoded ফরম্যাটে, যেখানে স্পেস লেখা হয় %20-এর বদলে + দিয়ে। ফর্মের ডেটা বা ফর্ম থেকে তৈরি কুয়েরি স্ট্রিং ডিকোড করার সময় “+ মানে স্পেস” চালু করুন; সাধারণ পাথের জন্য বন্ধ রাখুন, কারণ সেখানে + মানে শুধুই যোগ চিহ্ন।
প্রশ্নোত্তর
“ভুল গঠনের” ত্রুটি কেন আসে?
টেক্সটে এমন একটি % আছে যার পরে দুটি হেক্স অঙ্ক নেই (যেমন 100%), অথবা এমন বাইট-ক্রম আছে যা সঠিক UTF-8 নয় — প্রায়ই পুরোনো Latin-1 এনকোডার দিয়ে এনকোড করা টেক্সটে এমন হয়। টুলটি সমস্যার অবস্থান দেখায় এবং বাকি অংশ তবুও ডিকোড করে।
একই কী একাধিকবার থাকলে কী হয়?
পার্সার প্রতিটি উপস্থিতি ক্রমানুসারে দেখায়, কারণ ?tag=a&tag=b বৈধ এবং বহুল ব্যবহৃত। বারবার আসা কী চিহ্নিত করা থাকে, যাতে সহজেই চোখে পড়ে।
URL কি কোথাও পাঠানো হয়?
না। সবকিছু আপনার ব্রাউজারের নিজস্ব URL API দিয়ে প্রসেস হয়; কিছুই ফেচ বা আপলোড করা হয় না।