Convert CSV to GeoJSON

Free, private and fast: everything runs in your browser and your CSV file is never uploaded.

CSV to GeoJSON: why convert

Lists of shops, sensors, sightings or customers often start life in Excel or Google Sheets, with one row per place and a latitude and a longitude column. To put them on a web map you need GeoJSON. This converter finds the coordinate columns on its own when they have usual names such as lat, latitude, lon, lng, longitude, x or y, or uses a column of WKT text such as POINT (12.57 55.68), which also allows lines and polygons. It copes with the CSV variants Excel writes in different countries: commas or semicolons, decimal points or decimal commas, UTF-8 or the older Windows encoding. If the columns are not recognised, you choose them yourself. Every other column becomes a property. The file is read in your browser and never uploaded.

How to convert CSV to GeoJSON

  1. Drop your .csv file in the box, or click to choose it.
  2. Check the columns used for the coordinates, and enter the coordinate system if they are not longitude and latitude.
  3. Click Convert and download your GeoJSON file.

What changes when you convert

How the coordinate columns are found

A column whose values look like WKT is used as the geometry first. Otherwise the longitude or X column is the first whose name starts with lon, lng or long, or is x or easting, and the latitude or Y column the first that starts with lat, or is y or northing. The summary shows which columns were used, and you can choose others. A point in Copenhagen with latitude and longitude swapped lands in the Arabian Sea, so a look at the map before converting is worth it. Addresses are not turned into coordinates; the file needs numbers or WKT.

Semicolons and decimal commas

In Germany, France, Denmark and many other countries, Excel saves CSV files with semicolons between columns and a comma as the decimal mark, so 55,6813 means 55.6813. The separator (comma, semicolon, tab or pipe) is detected from the header row, and an Excel "sep=" first line is honored. Decimal commas are understood in files separated by semicolons or tabs; in a comma-separated file a comma can only be a separator. In a file with decimal commas, numbers with a thousands separator, such as 1.200, stay text. Coordinates in degrees, minutes and seconds, such as 55°40'52"N, are not supported; convert them to decimal degrees first.

Text encoding

UTF-8, with or without a byte order mark, and UTF-16 are recognised. A file that is not valid UTF-8 is read as Windows-1252, the encoding Excel on Windows uses for "CSV (Comma delimited)" in Western Europe and the Americas, so letters such as æ, ø, é and ñ survive. Other legacy encodings, such as Cyrillic or Asian code pages, are not detected; save those files as "CSV UTF-8" first.

Numbers, text and empty cells

A column becomes a number in the GeoJSON only when all its values are numbers. Values with a leading zero, such as the postcode 0800 or the ID 000123, keep the column as text, so nothing is lost. The coordinate columns are not repeated as properties. Rows with an empty or unreadable coordinate are kept with "geometry": null, and the page tells you how many there are.

The coordinate system

A CSV does not say which coordinate system its numbers are in. Longitude and latitude are taken to be WGS84, as from a GPS or Google Maps. When the values are clearly not degrees, for example UTM eastings and northings in metres, the page asks for the EPSG code, such as EPSG:25832 or EPSG:27700, and reprojects to WGS84. EWKT values with SRID=... fill in the code for you.

About the formats

CSV

CSV (comma-separated values) is a plain-text table that opens in Excel, Google Sheets and every database. It has no geometry type of its own: locations are stored either as two coordinate columns, such as latitude and longitude, or as a column of WKT text.

  • Points fit in two columns (X and Y, or longitude and latitude); lines and polygons need a WKT column.
  • The coordinate system is not stored in the file, so note it separately.
  • There is no standard for the separator: Excel uses a comma or a semicolon depending on the language settings.
  • Every value is text; whether 0800 is a number or a postcode is up to the program reading it.

GeoJSON

GeoJSON is a plain-text JSON format for geographic features, standardized as RFC 7946 in 2016. It is the native format of web maps such as Leaflet, MapLibre and Mapbox, and of many APIs.

  • Coordinates are WGS84 longitude, latitude (in that order).
  • Points, lines and polygons can be mixed in one file.
  • Properties can be any JSON value, with no limit on field name length.

Frequently asked questions

Is my CSV uploaded?

No. The file is read and converted by your own browser, so customer lists and other private addresses stay on your computer.

Which Excel option should I use to save the CSV?

"CSV UTF-8 (Comma delimited)" is the safest, because it keeps every character. The plain "CSV" option works too; the converter reads its Windows encoding and, in countries with a decimal comma, its semicolons.

Can the CSV contain lines and polygons?

Yes, in a WKT column. Each row holds one geometry, for example LINESTRING (12.56 55.67, 12.57 55.68) or a POLYGON or MULTIPOLYGON. Point coordinates in two columns can only give points.

Does it work with Google Sheets?

Yes. In Google Sheets choose File, Download, Comma-separated values, and drop that file here.