Skip to content
QGIS
Guide

GIS File Formats: Shapefile, GeoJSON, GeoPackage, GeoTIFF, KML

Published

A GIS file format is a standard way to store geographic data, either geometric shapes or a grid of pixels plus the coordinates that place them on Earth, in a file other software can read. When we exported the same 3,403 building polygons of Annecy, France to five common vector formats, the output ranged from 1.74 MB in a single CSV file to 4.05 MB in KML, with the classic shapefile landing at 2.58 MB across five separate files.

Every format falls into one of two families, as our vector vs raster guide explains in detail. Vector formats store points, lines and polygons alongside a table of attributes, which makes them right for boundaries, roads and building footprints. Raster formats store a grid of cells, such as satellite imagery or an elevation model. Choosing the right format decides whether your colleague can open the file, whether column names get cut in half, and how fast the map draws.

2.58MB in 5 files

Shapefile for 3,403 buildings

2 GB limit per component file, 10-character field names

2.37MB in 1 file

GeoJSON for the same layer

Plain text, locked to WGS 84 longitude and latitude

1.85MB in 1 file

GeoPackage for the same layer

SQLite database, default format in QGIS

Horizontal bar chart titled Same data, different file sizes comparing 3,403 Annecy building polygons across five formats: KML is 4.05 MB, Shapefile is 2.58 MB across 5 files, GeoJSON is 2.37 MB, GeoPackage is 1.85 MB, and CSV with WKT is 1.74 MB. Below, a second chart compares a 640 by 400 elevation grid as an uncompressed GeoTIFF at 0.98 MB versus a DEFLATE-compressed GeoTIFF at 0.41 MB.
The same 3,403 buildings saved with default GDAL settings. KML repeats XML tags around every vertex, while GeoPackage packs the geometries and attributes into one binary SQLite file.

GIS file formats compared

Before looking at how each file is built inside, here is how the six formats you will meet most often when you start working with GIS compare on structure, coordinate systems and limits.

FormatExtensionTypeFiles per layerCRS supportDocumented size limitBest for
Shapefile.shp, .shx, .dbf (+ .prj, .cpg)Vector3 to 7+Any (stored in .prj)2 GB per component fileLegacy software and public data portals
GeoJSON.geojson, .jsonVector1WGS 84 (CRS84, lon/lat)None in specWeb maps and web APIs
GeoPackage.gpkgVector and raster1 (holds many layers)Any140 TB in spec (4 GB on FAT32 drives)Desktop GIS work and file exchange
GeoTIFF.tif, .tiffRaster1Any (stored in TIFF tags)4 GB for classic TIFF, more with BigTIFFAerial imagery, elevation models, raster analysis
KML / KMZ.kml, .kmzVector (can bundle images)1WGS 84 (lon/lat)None in specViewing in Google Earth
CSV with coordinates.csv (+ optional .prj)Vector (mostly points)1Any (not stored inside the CSV)None in specSpreadsheets of points, geocoding inputs

How we measured the file sizes. On 16 November 2026, using GDAL 3.12.4 through pyogrio 0.13.0 with default options, we wrote the same layer of 3,403 building polygons in Annecy, France (from IGN's BD TOPO, 8 attributes, 34,076 vertices) to each vector format. Using 1,048,576 bytes per MB, the outputs measured:

  • KML (WGS 84): 4,251,540 bytes (4.05 MB) in 1 file.
  • Shapefile (Lambert-93): 2,700,826 bytes (2.58 MB) across 5 files.
  • GeoJSON (RFC 7946, WGS 84): 2,484,798 bytes (2.37 MB) in 1 file.
  • GeoPackage (Lambert-93): 1,941,504 bytes (1.85 MB) in 1 file.
  • CSV with WKT (WGS 84): 1,821,443 bytes (1.74 MB) in 1 file.

The order reflects how each format stores text and numbers. KML wraps XML tags around every coordinate list. The shapefile's .dbf table uses fixed-width records: GDAL gave each text field 80 characters, padding short words with spaces so every building row took 473 bytes, and BD TOPO buildings carry a height on every vertex, making the geometry PolygonZ. For the raster test, we exported a 640 by 400 cell elevation grid of the same Annecy area (5 m resolution, 32-bit floats): an uncompressed GeoTIFF took 1,025,166 bytes (0.98 MB), while DEFLATE compression shrank it to 428,433 bytes (0.41 MB) with no loss of precision. Sizes always depend on your data and export options, so treat this ranking as a typical result rather than a fixed law.

What is a shapefile (.shp, .shx, .dbf, .prj)?

A shapefile is an Esri vector format, documented in the ESRI Shapefile Technical Description (July 1998). Despite its singular name, a shapefile is never one file. It is a set of at least three required files that share the same base name, plus optional companion files.

Diagram titled Anatomy of a shapefile showing five file cards for the Annecy buildings layer: buildings.shp for geometry at 1,038.2 KB required, buildings.shx for the index at 26.7 KB required, buildings.dbf for attributes at 1,572.2 KB required, buildings.prj for the coordinate system at 452 bytes optional, and buildings.cpg for text encoding at 5 bytes optional. A side panel lists four BD TOPO field names truncated to 10 characters: nombre_d_etages to nombre_d_e, altitude_minimale_sol to altitude_m, methode_d_acquisition_planimetrique to methode_d_, and date_modification to date_modif.
The five files produced when exporting 3,403 Annecy buildings to a shapefile, and the four column names cut down to 10 characters inside the .dbf table.

On our 3,403 Annecy buildings, GDAL wrote five files totaling 2,700,826 bytes:

  • .shp (required, 1,063,136 bytes): stores the feature geometries. Under the 1998 specification, all non-null shapes in one shapefile must share the same shape type, so you cannot mix points, lines and polygons in one .shp.
  • .shx (required, 27,324 bytes): the positional index that lets software seek directly to any feature in the .shp. Its size is exact math: a 100-byte header plus 8 bytes for each of the 3,403 shapes.
  • .dbf (required, 1,609,909 bytes): a dBASE table holding the attributes, with one record per shape in the same order as the .shp.
  • .prj (optional, 452 bytes): stores the coordinate reference system as a Well-Known Text (WKT) string, here Lambert-93.
  • .cpg (optional, 5 bytes): declares the text encoding of the .dbf file. Ours contains the five-character string UTF-8, which GDAL's shapefile driver reads to decode accented letters properly.
  • Other optional files: Esri software also writes .sbn and .sbx for spatial indexing and .xml for metadata.

Because its attribute table is a dBASE file, the shapefile carries strict limits documented in Esri's geoprocessing considerations for shapefile output:

  • 10-character field names: any column name longer than 10 characters is cut off on export. On our Annecy BD TOPO export, GDAL cut four names: nombre_d_etages became nombre_d_e, altitude_minimale_sol became altitude_m, methode_d_acquisition_planimetrique became methode_d_, and date_modification became date_modif. When two long names share their first 10 characters, they collide, and GDAL renames one of them, for example by adding a number.
  • 2 GB size cap: Esri documents a 2 GB maximum for any component file, which holds roughly 70 million point features. GDAL notes that the format's 32-bit offsets could address more in theory, but advises staying under 2 GB for compatibility across software.
  • Attribute limits: at most 255 fields; text fields hold at most 254 characters; date fields store the calendar date with no time of day; numbers are stored as character strings, so decimals can round; and there is no support for NULL values (nulls are replaced, for example by 0 or a blank).

What is GeoJSON (.geojson)?

GeoJSON is a plain-text vector format built on JSON and standardized by the Internet Engineering Task Force in RFC 7946 (August 2016), following an earlier 2008 community specification. Everything lives in one .geojson or .json file that you can open in a text editor, compare in Git, or drop into our GeoJSON viewer.

Inside the file, a FeatureCollection holds an array of Feature objects, each pairing a properties dictionary with a geometry of type Point, LineString, Polygon, their Multi equivalents, or a GeometryCollection.

RFC 7946 locks the coordinate reference system of every compliant GeoJSON file to WGS 84 longitude and latitude in decimal degrees (OGC:CRS84), written in that exact order: longitude first, latitude second, with an optional third number for elevation in metres. That rule eliminates the missing-projection problem of shapefiles, and it makes GeoJSON the native language of web mapping libraries (MapLibre, Leaflet, OpenLayers) and web APIs.

The tradeoff is size and speed. Numbers are spelled out as characters and the file has no built-in spatial index, so software must parse the entire file from top to bottom, which gets slow on large datasets. To move between desktop and web workflows, use our shapefile to GeoJSON or GeoJSON to shapefile converters.

What is a GeoPackage (.gpkg)?

A GeoPackage is an open format defined by the OGC GeoPackage Encoding Standard (version 1.4.0) that stores spatial data inside a single SQLite database file ending in .gpkg. QGIS uses GeoPackage as its default format whenever you create or export a new vector layer.

Unlike a shapefile, one .gpkg file can hold many vector layers, raster tile pyramids and plain attribute tables at the same time, each with its own coordinate reference system and optional spatial index. Because it is built on SQLite, it has none of the dBASE flaws:

  • Column names can be as long and descriptive as you want (methode_d_acquisition_planimetrique stays intact).
  • Text fields exceed 254 characters, real NULL values and timestamps work properly, and numbers are stored in binary without string rounding.
  • The specification supports files up to about 140 TB, though saving onto a FAT32-formatted USB stick or memory card still caps any individual file at 4 GB.

When to switch from shapefile to GeoPackage

Move your workflow to GeoPackage when any of these happen:

  1. A .shp or .dbf file grows near the 2 GB limit.
  2. Truncated 10-character field names break your scripts or make tables unreadable.
  3. You need real NULL values, date-time fields, Unicode text without .cpg headaches, or strings longer than 254 characters.
  4. You want to bundle all the layers of a project (roads, parcels, buildings, lookup tables) into one file that cannot lose its .shx or .prj in an email attachment.

Keep exporting a shapefile only when a client contract, a legacy CAD program, or a government upload portal explicitly demands .shp.

What is a GeoTIFF (.tif)?

A GeoTIFF is a raster file format standardized in the OGC GeoTIFF Standard 1.1 (2019). It is a standard .tif or .tiff image file with embedded metadata tags that tell GIS software the coordinate reference system, the ground size of each pixel, and the coordinates of the image corner.

Because a GeoTIFF stores raw numeric bands rather than just screen colors, it handles aerial photographs (RGB and near-infrared), digital elevation models (32-bit floating-point heights in metres), and land-cover grids alike. Classic TIFF uses 32-bit file offsets and hits a hard ceiling at 4 GB; the BigTIFF variant, which GDAL reads and writes, goes beyond 4 GB.

Two variants matter in practice:

  • Lossless compression: enabling DEFLATE or LZW compression shrinks the file on disk without changing a single pixel value. On our 640 by 400 Annecy elevation grid, DEFLATE cut the file from 1,025,166 bytes to 428,433 bytes (58% smaller).
  • Cloud Optimized GeoTIFF (COG): a standard GeoTIFF organized so a client can read only the part it needs over the web. A web map or QGIS can then request just the area a user is looking at over HTTP, without downloading the whole image first.

KML, KMZ and CSV with coordinates

KML and KMZ. KML (Keyhole Markup Language), submitted by Google and adopted as the OGC KML 2.2 standard in April 2008, is an XML vector format built for displaying points, lines, polygons, 3D models and pop-up descriptions in Google Earth. A .kmz file is simply a zipped .kml that can bundle custom icon images alongside the geometry. Like GeoJSON, KML always uses WGS 84 longitude, latitude and optional altitude. Because XML repeats opening and closing tags around every feature, KML was the largest file in our Annecy benchmark at 4.05 MB. Read more in what a KML file is, preview files in the KML viewer, or convert them with KML to shapefile, shapefile to KML and KMZ to KML.

CSV with coordinates. A comma-separated values (.csv) file or Excel spreadsheet becomes a GIS layer when it includes two columns for longitude and latitude (or X and Y in metres), or a single column holding a Well-Known Text geometry such as POINT (6.1258 45.8988). On our Annecy polygons, a CSV with a WKT column was the smallest file of all at 1.74 MB, because it stores each building as one line of text with very little markup. However, a CSV carries no spatial index and no internal CRS definition. GDAL's CSV driver can read X/Y or WKT columns and write an accompanying .prj file, or you can convert point tables directly with CSV to shapefile and CSV to GeoJSON.

Other GIS formats you will meet

Beyond the main six, specialized domains rely on eight other formats:

  • GPX (.gpx): an XML schema for GPS waypoints, routes and recorded tracks from handheld receivers and sports watches.
  • FlatGeobuf (.fgb): a compact binary vector format with a built-in spatial index designed for streaming large vector layers over the web.
  • GeoParquet (.parquet): a columnar vector format built on Apache Parquet for cloud data warehouses and multi-gigabyte spatial analytics.
  • Esri File Geodatabase (.gdb): a folder of binary files used as Esri's native format in ArcGIS Pro, readable in QGIS via GDAL.
  • NetCDF (.nc): a multidimensional array format used in climate science and oceanography for grids that vary across space, depth and time.
  • JPEG 2000 (.jp2): a wavelet-compressed raster format used to distribute Copernicus Sentinel-2 satellite bands.
  • DXF and DWG (.dxf, .dwg): CAD drawing formats from AutoCAD, often lacking a declared CRS and holding lines on named layers rather than GIS feature tables.
  • LAS and LAZ (.las, .laz): the standard binary format (and its compressed twin) for 3D LiDAR point clouds.

Which GIS format should you use?

Pick the format that matches where the data is going next:

Your taskFormat to pickWhy
Save and share layers in desktop GISGeoPackage (.gpkg)One file, no 10-character truncation, holds multiple layers, fast spatial index
Build a web map or send data to an APIGeoJSON (.geojson)Native to JavaScript and browsers, fixed to WGS 84
Deliver to a client or portal asking for .shpShapefile (.shp zip)Universal backward compatibility with older GIS and CAD tools
Show placemarks and styles in Google EarthKML or KMZ (.kml, .kmz)Carries folder trees, icons, camera tilts and HTML pop-ups
Geocode addresses or share a table of pointsCSV (.csv)Opens in Excel, Python and every database
Store orthophotos, DEMs or raster outputsGeoTIFF (.tif) or COGPreserves exact pixel values, CRS tags and lossless compression

How to open and convert GIS file formats

You do not need a commercial license to inspect or convert any of these files.

  1. Open or convert in your browser

    For a quick check without installing software, drop your file into our free shapefile viewer, GeoJSON viewer or KML viewer. To switch formats on the spot, use shapefile to GeoJSON, KML to shapefile or CSV to GeoJSON.

  2. Drag and drop into QGIS

    Open QGIS and drag a .gpkg, .geojson, .tif, .kml, or the .shp file from an unzipped shapefile folder directly onto the map canvas. Right-click the layer and choose Export > Save Features As... (or Save Raster Layer As...) to convert it to any other format and reproject it at the same time. If a shapefile arrived without its .prj file and lands in the wrong place, check what a CRS is and find the right code in our CRS lookup.

  3. Batch-convert on the command line with ogr2ogr

    When you have a hundred files to convert or want to automate a pipeline, GDAL's ogr2ogr utility converts between vector formats in one command (for example, ogr2ogr -f GPKG buildings.gpkg buildings.shp). Use our ogr2ogr command builder to generate the exact flags for reprojection, filtering and layer naming.

Inside QGIS, AI Agent, the plugin we build, can also load, reproject and export layers between these formats from a plain sentence, such as asking it to merge a folder of shapefiles into a single GeoPackage in your national CRS.

Questions people ask

Do it now with our free tool

Convert Shapefile to GeoJSON

Open the free tool

Do it in QGIS by asking for it

AI Agent carries out the task you describe, in your own QGIS project. Free, no card.

Try AI Agent for free

Keep reading