एन्कोडिंग
Gzip/Deflate ↔ Base64
टेक्स्ट को Gzip या Deflate में कंप्रेस करके परिणाम को Base64 में एन्कोड करना — और वापस। Compression Streams API के ज़रिए सीधे ब्राउज़र में काम करता है।
Base64 by itself doesn't compress anything — quite the opposite, it grows the size by about 33%. To send large text compactly through a text-only channel, it's first compressed with Gzip or Deflate, and only then is the result Base64-encoded.
How to use it
- Compress: paste text and the tool compresses it with Gzip or Deflate (the browser's Compression Streams API) and encodes the result as Base64.
- Decompress: paste a Base64 string of compressed content to get the original text back.
- Pick Gzip or Deflate depending on which format the receiving system expects.
Common uses
- Compactly embedding a large text value (an SVG, a config) in a URL parameter or cookie with a size limit.
- Preparing a compressed payload for an API that accepts Base64-encoded Gzip data.
- Decompressing data received in this format from another system so it can be read manually.
Things to keep in mind
Compression only pays off on sufficiently large, compressible text — on short strings the Gzip header overhead plus the Base64 expansion can actually make the result bigger.
Deflate skips Gzip's headers, so its output is more compact, but the format is less self-describing: the receiving side needs to know in advance that it's Deflate specifically.
इस टूल के बारे में लेख: Gzip + Base64: डेटा को टेक्स्ट के रूप में भेजने के लिए संपीड़न
अक्सर पूछे जाने वाले प्रश्न
Gzip और Deflate में क्या फ़र्क़ है?
दोनों एक ही DEFLATE कंप्रेशन एल्गोरिदम इस्तेमाल करते हैं, लेकिन Gzip में एक हेडर और CRC चेकसम भी जुड़ा होता है, जबकि Deflate रॉ (बिना रैपर वाला) डेटा होता है — इसलिए गलत फ़ॉर्मेट चुनने पर डिकंप्रेशन फेल हो सकता है।
डिकोड करते वक़्त एरर क्यों आती है?
अक्सर यह इसलिए होता है क्योंकि एन्कोड करते वक़्त इस्तेमाल किया गया फ़ॉर्मेट (Gzip या Deflate) डिकोड के वक़्त चुने गए फ़ॉर्मेट से मेल नहीं खाता, या Base64 स्ट्रिंग अधूरी/करप्ट है।
क्या टेक्स्ट कहीं सर्वर पर भेजा जाता है?
नहीं, कंप्रेशन और एन्कोडिंग ब्राउज़र के नेटिव Compression Streams API से लोकली होती है, कुछ भी अपलोड नहीं होता।
अनपैक करते वक़्त कभी-कभी "invalid header" एरर क्यों आती है?
सबसे आम वजह है फ़ॉर्मेट का उलझ जाना: डेटा "रॉ" Deflate के रूप में बिना हेडर के कंप्रेस किया गया है, लेकिन अनपैक Gzip के रूप में किया जा रहा है (जो अपना हेडर और CRC-32 चाहता है), या इसका उल्टा। टूल की सेटिंग में फ़ॉर्मेट बदलकर देखें।
क्या कंप्रेशन हमेशा फ़ाइनल साइज़ घटा देता है?
नहीं। बहुत छोटी स्ट्रिंग्स पर Gzip हेडर और Base64 से बढ़ने वाला साइज़, कंप्रेशन के फ़ायदे से ज़्यादा हो सकता है — यह तरीका सिर्फ़ पर्याप्त बड़े और अच्छी तरह कंप्रेस होने वाले टेक्स्ट डेटा के लिए ही समझदारी भरा है।