Skip to content

Free · Lossless · Byte-exact

Compress CSV Files Online

Create a .csv.gz download from the original CSV bytes without parsing or normalizing the source.

CSV → Gzip

The original CSV bytes are preserved in the gzip output.

8 fictional rows · CC0

Gzip packages original bytes; it does not trim values or remove duplicate rows. To restore elsewhere: gzip -dk report.csv.gz. For different goals, clean records, split your CSV or convert to Parquet.

  1. Choose your CSV

    Select a non-empty .csv file up to 50 MB, or try the sales sample.

  2. Compress CSV

    Run the operation and check the original and gzip sizes.

  3. Download gzip

    Save the result with the original file bytes preserved.

Byte-exact round trip

What the CSV compressor does

The compressor preserves the selected file as-is. Byte order marks, delimiters, quotes, encodings, and line endings remain part of the original byte sequence and return unchanged after decompression.

Inputs must be non-empty .csv files no larger than 50 MB. The download appends .gz to the complete original filename, such as report.csv.gz.

Plain answers

CSV compression questions

Does compression change my CSV?

No. The original file bytes are passed directly into gzip without parsing or reserializing the CSV. Decompressing the result restores the exact selected bytes.

Will gzip always make a CSV smaller?

No. Repeated text usually compresses well, but a very small or high-entropy CSV can grow because a gzip file also contains framing data.

How do I open the .csv.gz download?

Select Restore gzip on this page to restore the exact original bytes. Compressed inputs and restored outputs are limited to 50 MB. You can also use a gzip-compatible archive tool or command.

Other ways to work with your CSV

Use these local examples when you prefer a script or SQL. They create separate results and explain where their behavior differs from this browser tool.

Compress and restore exact CSV bytes with Python

Creates gzip output and a byte-identical restored.csv without parsing the CSV.

Before you start

  • Python 3.10 or later. Run in a working folder with a backup of your source; output files may be replaced unless opened in exclusive mode.
  • Place input.csv in that folder. Examples use UTF-8, a comma delimiter and a header row. Column-specific recipes use id,label,amount,status,note; adapt names to your file.
Run the complete Python example
python3 - <<'PY'
import gzip
import shutil

with open("input.csv", "rb") as source, gzip.open("input.csv.gz", "wb") as target:
    shutil.copyfileobj(source, target)
with gzip.open("input.csv.gz", "rb") as source, open("restored.csv", "wb") as target:
    shutil.copyfileobj(source, target)
with open("input.csv", "rb") as original, open("restored.csv", "rb") as restored:
    assert original.read() == restored.read()
print("Created input.csv.gz and verified restored.csv matches the original bytes")
PY

Limits and output

  • CSV has no stored type schema. Python keeps fields as strings until an example explicitly converts a value. These recipes do not add spreadsheet formula protection; import sensitive-looking strings as text in spreadsheets.
  • Compression is streamed, but the final equality check loads both files into memory. Small or already compressed content may not get smaller.

Documentation: Python CSV reader and writer; Python gzip