Gzip圧縮テスト
テキストやBase64文字列がGzipでどれだけ圧縮されるかテスト。圧縮率、サイズ比較、データ整合性の検証 — すべてブラウザで実行。
100%クライアントサイド — データがデバイスから離れることはありません
Enter text or a Base64 string to test how well it compresses with gzip
コード例
プロジェクトにすぐに使えるコードスニペットです。
Python
import gzip
import base64
# Compress text with gzip and encode as Base64
text = "Hello, World! " * 100
compressed = gzip.compress(text.encode("utf-8"))
b64 = base64.b64encode(compressed).decode()
print(f"Original: {len(text)} bytes, Compressed: {len(compressed)} bytes")
print(f"Ratio: {len(compressed) / len(text):.1%}")
# Decompress from Base64-encoded gzip
decoded = base64.b64decode(b64)
decompressed = gzip.decompress(decoded).decode("utf-8")
assert decompressed == text # Data integrity check
# Compress a file
with open("data.json", "rb") as f:
compressed = gzip.compress(f.read())
with open("data.json.gz", "wb") as f:
f.write(compressed)よくある質問
以下を検索するか、よくある質問をご覧ください。
テキスト、JSON、またはBase64文字列を入力エリアに貼り付けると、ツールがブラウザに内蔵されたCompression Streams APIを使用してGzip圧縮を行います。元のサイズ、圧縮サイズ、圧縮率が表示され、すべての計算はローカルで行われ、データがデバイスから離れることはありません。
Base64文字列はすでに元のバイナリデータより約33%大きくなっています。Gzipで圧縮すると、特に繰り返しの多いテキストコンテンツの場合、このオーバーヘッドを回収できることがよくあります。このツールは、APIやWebサーバーでGzipを有効にする価値があるかどうかを判断するのに役立ちます。
完全にコンテンツに依存します。繰り返しの多いテキストは80〜90%圧縮できますが、ランダムデータや既に圧縮されたデータ(JPEG画像や暗号化コンテンツなど)はほとんど縮まないこともあります。このツールは正確な比率を表示するので、情報に基づいた判断ができます。
一般的には機能せず、Gzipのヘッダーオーバーヘッドにより実際にはわずかに大きくなることもあります。既に圧縮されたデータ(PNG画像やZIPファイルをBase64エンコードしたものなど)をテストする場合、追加の圧縮はほとんどまたは全く期待できません。いずれの場合でも、ツールは正直な結果を表示します。
はい、Gzipは完全にロスレスです。データを解凍すると、入力した内容とまったく同じものが得られます。ツールはGzip出力を解凍して元の入力と比較することでこれを検証します。
Related Tools
Base64 Converter
Encode text to Base64 or decode Base64 to text — all in one tool
Base64 Compare
Side-by-side comparison of two Base64 strings with visual diff highlights
Base64 Analyzer
Analyze Base64 strings to determine their validity, character set, padding, length, and decoded data type
Base64 Encoder
Encode plain text to Base64 format with UTF-8, ASCII, and ISO-8859-1 support