Convert CSV to GeoJSON in your browser
This tool turns a plain CSV with latitude and longitude columns into a valid
GeoJSON FeatureCollection of point features, ready to drop into Leaflet,
Mapbox, QGIS, or any GIS tool that reads GeoJSON. It is built for analysts and
developers who have tabular location data and need map-ready output without writing a
script.
How it works
The converter first parses the CSV, respecting quoted fields that contain commas or
line breaks (RFC 4180 quoting). It reads the header row, then scans those headers to
auto-detect the latitude and longitude columns by matching common names such as
lat, latitude, lon, lng and longitude. For every data row it builds a
Point geometry with coordinates written in [longitude, latitude] order — the
order the GeoJSON spec mandates — and copies all remaining columns into the feature’s
properties. Values that look numeric are converted to numbers so they work with
data-driven styling.
Example
This CSV:
name,lat,lon,population
London,51.5074,-0.1278,8900000
Hanoi,21.0278,105.8342,8050000
becomes a FeatureCollection where each city is a Point feature with name and
population in its properties:
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": { "type": "Point", "coordinates": [-0.1278, 51.5074] },
"properties": { "name": "London", "population": 8900000 }
}
]
}
Note that coordinates are [longitude, latitude] — the GeoJSON spec puts longitude first, which is the reverse of the common lat/lon reading order. Getting this wrong produces points mirrored across the diagonal.
Where to use the output
The resulting GeoJSON can be dropped directly into:
- Leaflet —
L.geoJSON(data).addTo(map)renders all points instantly. - Mapbox GL JS — add as a
geojsonsource and style with acircleorsymbollayer. - QGIS — drag the
.geojsonfile onto the canvas to import it as a vector layer. - kepler.gl / Felt / Carto — all accept GeoJSON uploads for quick thematic maps.
Tips and common issues
| Problem | Cause | Fix |
|---|---|---|
| Points appear in the wrong place | Columns swapped: lat in lon field or vice versa | Swap the dropdowns manually |
| Fewer features than CSV rows | Invalid or blank coordinates | Check the skipped-rows count and clean the source |
| Properties show as strings | Numeric-looking but contains spaces or text | Clean the column in the CSV first |
GeoJSON structure produced
The output is always a FeatureCollection — the most widely supported GeoJSON container — containing one Point feature per valid CSV row. This structure can be passed directly to mapping libraries without any further transformation.
The GeoJSON spec (RFC 7946) defines the coordinates array as [longitude, latitude, elevation]. Elevation is omitted when not present in the source. Always check that your coordinate columns are assigned correctly: a column named lat placed in the longitude slot will produce mirrored points (reflected across the prime meridian or equator).
When your coordinates use different column names
The auto-detection matches these column names (case-insensitive):
- Latitude:
lat,latitude,y,ylat,lat_deg - Longitude:
lon,lng,long,longitude,x,xlon,lon_deg
If your columns don’t match these (for example coord_north and coord_east), select the correct columns from the dropdowns that appear after parsing.
After converting
Once you have GeoJSON, common next steps include:
- Validate it at geojsonlint.com or with the GeoJSON Validator tool to catch coordinate range errors (latitude must be −90 to 90; longitude −180 to 180).
- Style it in Mapbox GL JS using data-driven expressions on the properties, for example colouring each point by its
populationfield. - Convert it further to KML, Shapefile, or TopoJSON using a tool like GDAL or Mapshaper if your GIS workflow requires a different format.
All conversions run locally in your browser — nothing is uploaded.