How to Open a .csv.gz File
A file named data.csv.gz is an ordinary CSV file that has been compressed with gzip. Data portals, cloud exports and log pipelines use it because text compresses well: a CSV often shrinks to a fraction of its size, which makes it faster to download and cheaper to store.
The catch is that Excel, Google Sheets and Numbers cannot read the compressed file. You either decompress it first or use a tool that reads gzip directly. This guide covers both.
What a .csv.gz file is (and is not) #
gzip compresses one file. Inside data.csv.gz there is exactly one data.csv, nothing else. That makes it different from:
.zip, which can hold many files and folders..tar.gzor.tgz, which is a folder of files bundled withtarand then gzipped. Extract it withtar -xzf archive.tar.gz.
If you only want to look at the data, you do not need to decompress the file to disk at all.
Option 1: view it in your browser without decompressing #
The Gzip CSV Reader opens a .csv.gz file directly in the browser tab. It decompresses the file as a stream on your device, so nothing is uploaded and nothing extra is written to your disk.
- Open the Gzip CSV Reader and choose your
.csv.gzfile. - The first 50,000 rows appear in a table.
- Below the table, the reader shows the total row count. It reads the whole file to count every row, even when that is millions.
Because the file is streamed, multi-gigabyte files work without filling your computer's memory. It also accepts .zip files that contain a CSV.
The reader checks the file's first bytes rather than trusting the name. If your "gzip" file is really a bzip2, XZ, 7-Zip, Zstandard or RAR archive, it tells you, since browsers cannot extract those formats.
Option 2: decompress it in your browser #
When you need the full CSV, for Excel or another program, use the CSV Decompressor. It turns data.csv.gz back into data.csv, again without uploading anything:
- Open the CSV Decompressor and choose the file.
- Click Decompress.
- Save the resulting
.csv.
Decompression is streamed, so memory use stays flat. In Chrome and Edge the result is written straight to a file you choose, with no fixed size limit. Firefox and Safari hold the result in the browser's storage on disk, which allows results up to about 10 GB.
Option 3: decompress it on your computer #
macOS. Double-click the file. Archive Utility extracts data.csv into the same folder.
Windows. Install 7-Zip (free), right-click the file and choose 7-Zip > Extract Here. 7-Zip opens .gz on every Windows version.
macOS and Linux terminal. Use gunzip. The -k flag keeps the original .gz file:
gunzip -k data.csv.gz # writes data.csv next to it
To peek at the first lines without writing anything to disk:
gzip -dc data.csv.gz | head -n 5
On Linux, zcat data.csv.gz does the same. On macOS, the built-in zcat looks for .Z files instead, so use gzcat or gzip -dc.
Once you have data.csv, Excel, Google Sheets and Numbers open it normally. Remember Excel's limit of 1,048,576 rows per sheet: if the CSV is bigger, Excel loads only the first rows. Split the large CSV into smaller files first.
Option 4: read it directly with Python or DuckDB #
Most data tools read gzip without a separate step.
pandas detects the compression from the .gz extension:
import pandas as pd
df = pd.read_csv("data.csv.gz")
print(df.head())
DuckDB queries the compressed file with SQL, no decompression needed:
SELECT count(*) FROM 'data.csv.gz';
SELECT * FROM 'data.csv.gz' LIMIT 10;
-- Save a filtered slice as a regular CSV
COPY (SELECT * FROM 'data.csv.gz' WHERE id <= 1000) TO 'slice.csv';
This is the best route when the file is too large for a spreadsheet and you only need part of it.
When a .csv.gz file will not open #
- "Not in gzip format". The file may already be decompressed. Some web servers send files gzip-encoded, the browser decompresses them while downloading and keeps the
.gzname. Open it in a text editor: if you can read the rows, rename it to.csv. The Gzip CSV Reader detects this and shows the CSV anyway. - "Unexpected end of file". The download was cut off. gzip stores a checksum at the end of the file, so a truncated file cannot be fully read. Download it again.
- The wrong size is reported.
gzip -lprints the uncompressed size, but the gzip format only stores it modulo 4 GB, so the number is wrong for larger files. Decompress or stream the file to know the real size. - Garbled characters. The CSV inside may not be UTF-8. Decompress it first, then open it with the right encoding.
How to make a .csv.gz file #
Going the other way is just as easy: gzip -k data.csv on the command line, or the browser-based CSV Compressor. Our guide on how to make CSV files smaller explains when gzip is the right choice and when Parquet is better.
FAQ #
Can Excel open a .csv.gz file? #
Not directly. Decompress it first with the CSV Decompressor, 7-Zip, Archive Utility or gunzip, then open the .csv in Excel.
How do I open a .csv.gz file without unzipping it? #
Use the Gzip CSV Reader in your browser, gzip -dc data.csv.gz | head in a terminal, or read it directly with pandas or DuckDB.
Is .gz the same as .zip? #
No. Both use the DEFLATE compression method, but a .zip is an archive that can hold many files, while a .gz compresses a single file. Most unzip tools, including 7-Zip, open both.
Are .csv.gz files safe to open? #
The compression itself is harmless, and a CSV is plain text. Viewing it in a browser-based reader or a text editor does not run anything. Be careful opening CSVs from unknown sources in a spreadsheet, as cells starting with = are treated as formulas.
How big can the file be? #
The Gzip CSV Reader has no fixed limit because it streams the file and shows the first 50,000 rows. For the full file, the CSV Decompressor handles multi-gigabyte results.
Try the tools from this post
Free and private: your files stay in your browser.