मुख्य सामग्री पर जाएं

developer-tools

Base64, URL Encoding & HTML Entities: Developer Guide

robinhood-projects5 मिनट पढ़ें

Base64 एनकोड और डीकोड

Text या binary data को Base64 में encode करें और Base64 strings को plain text में decode करें, ब्राउज़र में instantly।

टूल इस्तेमाल करें →

URL एनकोड / डीकोड

Query strings में safe use के लिए URLs को percent-encode करें, या encoded URLs को plain text में decode करें।

टूल इस्तेमाल करें →

HTML Entities एनकोड और डीकोड

Special characters को HTML entities में encode करें और HTML entities को plain text में decode करें।

टूल इस्तेमाल करें →

Base64, URL Encoding और HTML Entities: हर Developer को क्या जानना चाहिए

अगर आप web development करते हैं, तो encoding की problems से ज़रूर मिले होंगे। एक URL टूट जाता है क्योंकि & गलत जगह है। HTML page पर < literally दिखने लगता है tag की जगह। कोई API SGVsbG8gV29ybGQ= जैसी strange string return करती है और आप समझ नहीं पाते। ये सब encoding problems हैं, और तीन schemes सबसे ज़्यादा आती हैं: Base64, URL encoding, और HTML entities।

इस guide में हम explain करेंगे कि इनमें से हर एक कैसे काम करता है, concrete examples देंगे, और free online tools बताएंगे — बिना कोई software install किए।

Base64 क्या है?

Base64 एक तरीका है binary data को printable ASCII characters में represent करने का। यह किसी भी byte sequence को 64 characters के alphabet में map करता है: A–Z, a–z, 0–9, + और /। Output हमेशा text होता है, जिससे यह उन जगहों पर safe रहता है जहाँ raw binary data allow नहीं होती — email attachments, JSON payloads, CSS में data: URLs, और JWT tokens सभी Base64 use करते हैं।

Example — "Hello World" को Base64 encode करना:

  • Input: Hello World
  • Base64 output: SGVsbG8gV29ybGQ=

अंत में = padding है। Base64 हमेशा ऐसा output देता है जिसकी length 4 की multiple हो।

कब use करें:

  • Images या fonts को CSS या HTML में directly embed करना (data:image/png;base64,...)
  • Binary data को JSON APIs के लिए encode करना जो सिर्फ text accept करती हैं
  • JWT tokens read या generate करना (header और payload Base64url-encoded होते हैं)

Base64 encryption नहीं है। जो भी string देखे, वो seconds में decode कर सकता है। इसे encoding के लिए use करें, information hide करने के लिए नहीं।

FileCrank का Base64 encode decode online tool अभी try करें।

URL Encoding (Percent Encoding) क्या है?

URLs में safely सिर्फ limited characters आ सकते हैं। Spaces, &, =, /, और non-ASCII characters URL में structural meaning रखते हैं — या simply valid नहीं होते। URL encoding (officially percent encoding कहते हैं) unsafe characters को % sign से replace करती है, जिसके बाद character के UTF-8 byte value के दो hexadecimal digits होते हैं।

Example — "Hello World" को URL encode करना:

  • Input: Hello World
  • URL-encoded output: Hello%20World

Space %20 बन जाता है। & बन जाता है %26। / बन जाता है %2F।

कब use करें:

  • Query strings बनाना: ?q=hello%20world&lang=hi
  • Form data में special characters pass करना
  • User input वाले API requests construct करना

Modern JavaScript में encodeURIComponent() है इसके लिए, लेकिन encoded URL को debug करना हो तो online tool console खोलने से ज़्यादा fast है।

FileCrank का URL encode decode online tool use करें।

HTML Entities क्या होते हैं?

HTML कुछ characters को syntax के रूप में use करता है। < और > tags को define करते हैं, & entity reference start करता है, और " attribute values को wrap करता है। अगर आपके content में ये characters literally हों — जैसे किसी page पर source code display करना हो — तो इन्हें escape करना ज़रूरी है, वरना browser इन्हें markup समझेगा।

HTML entities इन characters को named या numeric references से replace करते हैं:

CharacterEntity nameNumeric entity
<&lt;&#60;
>&gt;&#62;
&&amp;&#38;
"&quot;&#34;
©&copy;&#169;

Example — HTML tag को text की तरह display करना:

Page पर <h1>Hello World</h1> literal string दिखानी हो, तो लिखेंगे:

&lt;h1&gt;Hello World&lt;/h1&gt;

कब use करें:

  • Documentation या blog posts में code examples दिखाना
  • User input को HTML में insert करने से पहले escape करके XSS vulnerabilities रोकना
  • Typographic symbols insert करना (&mdash;, &copy;, &nbsp;)

FileCrank का HTML entities tool seconds में escape और unescape करता है।

तीनों को side-by-side compare करें

Same input, तीन methods से process करने पर:

EncodingInputOutput
Base64Hello WorldSGVsbG8gV29ybGQ=
URL encodingHello WorldHello%20World
HTML entities<Hello>&lt;Hello&gt;

तीनों अलग problems solve करते हैं और interchangeable नहीं हैं:

  • Base64 binary data को text में convert करता है। Use करें जब binary data text-only context में embed करनी हो।
  • URL encoding URL में illegal या ambiguous characters handle करता है। Use करें URLs या query strings बनाते वक्त।
  • HTML entities HTML syntax के reserved characters handle करते हैं। Use करें जब HTML documents में text output करना हो।

Common Mistakes

Mistake 1: Base64 को security के लिए use करना। Base64 output gibberish लगता है, लेकिन यह trivially reversible है। Passwords या tokens "hide" करने के लिए use न करें। Proper encryption या hashing use करें।

Mistake 2: URL double-encoding। पहले से encoded string पर encodeURIComponent() call करने से %20 की जगह %2520 मिलेगा। पहले decode करें, फिर encode।

Mistake 3: Templates में HTML escape भूलना। User data को बिना escape किए directly HTML में insert करना XSS vulnerabilities की main वजह है। Render करने से पहले हमेशा escape करें।

Tools try करें

तीनों tools completely free हैं, browser में run होते हैं, और account की ज़रूरत नहीं:

इन्हें bookmark करें। हर हफ्ते कम से कम एक काम आएगा।