Skip to content
LidarKit

What is an XYZ file?

A point cloud written as plain text, one point per line — the format everything can write and almost nothing describes.

Published · Updated

An XYZ file is a point cloud stored as text. Each line is one point, and the first three numbers on it are its X, Y and Z coordinates. Anything after them — intensity, colour, a classification code, a timestamp — is up to whoever wrote the file. Open one in a text editor and it looks like this:

3D view of a city block point cloud read from a text file
An XYZ file is enough to draw a cloud: 79,049 lines of “x y z r g b” text, shown in 3D.
148811.100 170750.000 41.710 25 65 71 70
148811.080 170750.100 39.700 37 62 68 66
148810.570 170750.020 39.710 44 87 92 88

That simplicity is why it is everywhere. Every scanner package, survey instrument, GIS, spreadsheet and ten-line script can produce it, so it is the format a point cloud falls back to when nothing better is agreed. It is also why it is the hardest point cloud format to read correctly: the file states almost nothing about itself.

The variants

"XYZ" is a family rather than a specification. The extension is a hint about the layout, not a promise.

ExtensionUsual layout
.xyzSpace-separated, no header. Three columns, or more after them.
.ptsLeica Cyclone: the point count alone on the first line, then x y z i r g b, intensity from −2048 to 2047.
.csvComma-separated, usually with a header row naming the columns. Semicolons and decimal commas in European exports.
.txtAnything. Tab-separated survey exports, CloudCompare's //X,Y,Z header, plain coordinate lists.
.ptxA relative, not a member: one block per scan, each a grid of points with its own scanner position and transform matrix.

Two near-namesakes are not point clouds at all. The chemistry XYZ format lists atoms — an element symbol and three coordinates per line, under a count and a comment line. And .asc is often the ESRI ASCII grid, a raster with a header of rows, columns and cell size rather than a list of points.

What a line can hold

Beyond the three coordinates, the columns that turn up most are the same ones a LAS file carries:

  • Intensity — the strength of the return, on whatever scale the writer chose: 0–255, 0–65 535, 0–1, Leica's −2048…2047, or decibels.
  • Colour — red, green and blue, as 0–255 integers, 16-bit integers or 0–1 floats.
  • Classification, return number, number of returns, GPS time — when the text was exported from a LAS file, which is common.
  • Normals — three columns forming a unit vector, from photogrammetry and from tools that estimate surface orientation.

Some files grid their points: digital elevation models and bathymetry surveys are often distributed as XYZ with one line per grid cell, every X and Y on a regular spacing. Those are still point lists, and read as such.

What the file does not say

This is the part that decides whether a reader gets the file right.

  • What the columns are. Without a header, the only convention is that X, Y and Z come first. Seven columns are usually x y z i r g b, but x y z r g b i is just as possible. Six columns may be colour or normals.
  • What range a value is on. A colour of 0.8 is bright on a 0–1 scale and almost black on a 0–255 one. Guess wrongly and the cloud comes out black or blown out white.
  • The units and the coordinate system. Nothing in the text says whether 148811.1 is metres, feet or something else, nor in which projection. A coordinate system travels, if at all, in a separate .prj file.
  • How many points there are. Except for PTS, which states it on its first line, the count is only known once the last line has been read.

So the honest way to read an XYZ file is to look before deciding: sample lines from across the whole file, infer the delimiter and the ranges, read a header if there is one — and show the result to the person who knows what the data is, so a wrong guess can be corrected rather than baked in.

Size and precision

Text costs a byte per character. A coordinate written as 148811.100 takes eleven bytes with its separator; LAS stores it as a four-byte integer, and LAZ compresses that further still. Measured on one airborne tile of 5.85 million points:

Stored asSizeBytes per point
CSV, eleven columns568 MB97
LAS 1.4, point format 7211 MB36
LAZ36 MB6

Precision works the other way round from what the size suggests: a text file holds exactly the digits it was written with, no more. Three decimals in metres is a millimetre; two is a centimetre. Converting to LAS should keep that, not invent finer digits that were never measured.

Working with an XYZ file here

Open it in the XYZ viewer — the delimiter, header and column roles are worked out and shown in a table, every role can be changed, and the points are drawn in 3D as soon as they are read.

Convert it to LAS or LAZ — with the precision the file's own numbers use, the coordinate system from its .prj, and bad lines reported by line number instead of quietly dropped. The XYZ vs LAS comparison covers what the conversion gains and decides.

Make one from a LAS or LAZ file — for Rhino, a spreadsheet or a script, with the columns you choose and every coordinate printed exactly as the LAS file stores it. All three tools run in the browser, and nothing is uploaded.

Frequently asked questions

What is an XYZ file?
A point cloud stored as plain text: one point per line, its X, Y and Z coordinates first, optionally followed by more numbers such as intensity or colour. It has no required header and no fixed delimiter, which is why every scanner, survey package and point cloud tool can write one — and why reading one means working out what its columns are.
How do I open an XYZ file?
Drop it on the XYZ viewer on this site. It works out the delimiter and whether there is a header, shows a table of the columns with what each was read as, and draws the points in 3D. Any column read wrongly can be changed and the view follows. Nothing is uploaded.
What is a PTS file?
The text format of Leica's Cyclone software: a first line holding the point count, then one point per line as x y z intensity red green blue. Its intensity runs from −2048 to 2047 rather than from zero, which is the detail most readers get wrong — read naively, every point has a negative intensity.
Are XYZ, TXT and CSV point clouds different formats?
Not really. They are the same idea under different extensions: .xyz usually means space-separated with no header, .csv comma-separated with a header row, and .txt anything at all. A reader that trusts the extension gets some of them wrong; one that looks at the content reads them all.
What units are the coordinates in?
Whatever the writer used — the file does not say. Projected survey data is usually in metres or feet; data in longitude and latitude is in degrees and is easy to spot, because the values stay within ±180 and ±90 and span a fraction of a degree. The units matter as soon as the points are converted: a precision of 1 mm is right for metres and useless for degrees.
Can an XYZ file have a coordinate system?
Not inside the file. A coordinate system travels, when it travels at all, as a separate .prj file with the same name, holding a WKT description. Keep the two together: once the points are converted to LAS, the coordinate system can be written into the LAS file itself and the .prj is no longer needed.
Why is my XYZ file so large?
Because every digit is a byte. A coordinate like 148811.100 costs ten characters plus a separator as text, against four bytes as a LAS integer and less again after LAZ compression. A 5.85-million-point airborne tile measured for this article is 568 MB as an eleven-column CSV, 211 MB as LAS and 36 MB as LAZ.
How do I convert XYZ to LAS or LAZ?
Drop the file — and its .prj, if there is one — on the XYZ to LAS converter on this site. It shows the columns, the precision it will store the coordinates at and the coordinate system before it writes anything, then writes LAS 1.4 or LAZ on your own machine.