BYTETOOLS

WKB to WKT Converter

Decode hex-encoded WKB or PostGIS EWKB into readable WKT and GeoJSON, with the SRID, dimensionality, byte order and vertex count explained.

Paste a hex WKB string, or click one of the examples above, to see the WKT and GeoJSON it represents.

What is the WKB to WKT Converter?

Query a PostGIS geometry column without wrapping it in ST_AsText and you get a wall of hex starting 0101000020E6100000.

  • Decodes plain OGC WKB, ISO WKB with Z and M type offsets, and PostGIS EWKB
  • Handles both byte orders and every type from Point to GeometryCollection
  • Reports SRID, dimensionality, vertex count, payload size and the encoding flavour
  • Outputs both WKT — with the SRID prefix when present — and a GeoJSON geometry
  • Optional coordinate rounding, with the full stored precision available
  • Specific, readable errors for truncated or invalid hex, all decoded locally

How to use the WKB to WKT Converter

  1. 1

    Paste the hex WKB string, with or without a leading backslash-x or 0x prefix.

  2. 2

    Or click one of the example buttons to see a decoded point, an EWKB with an SRID, or a line.

  3. 3

    Choose whether to keep every stored digit or round the coordinates.

  4. 4

    Read the WKT, the GeoJSON geometry and the header breakdown.

  5. 5

    Copy either output, or download the WKT as a file.

About the WKB to WKT Converter

Query a PostGIS geometry column without wrapping it in ST_AsText and you get a wall of hex starting 0101000020E6100000. This converter decodes that string back into readable Well-Known Text and a GeoJSON geometry, reading the byte-order flag, the geometry type, and the high bits that carry Z, M and the SRID in PostGIS's EWKB extension.

It handles both flavours you will run into — PostGIS EWKB, where Z, M and SRID live in the top bits of the type word, and ISO/OGC WKB, where they come from the type offsets of 1000, 2000 and 3000 — as well as big-endian and little-endian encodings and every geometry from Point through GeometryCollection. Truncated or malformed hex gets a specific error saying what went wrong instead of a stack trace.

The decoding happens entirely in your browser using a DataView over the bytes. Nothing is uploaded, so you can safely paste geometry straight out of a production dump or a log file without it leaving your machine.

Frequently asked questions

What is WKB?

Well-Known Binary is the compact binary form of a geometry defined by the OGC Simple Features standard. It stores a byte-order flag, a geometry type number and then raw 8-byte doubles for the coordinates, which is why databases store it instead of the much larger text form.

What is the difference between WKB and EWKB?

EWKB is PostGIS's extension. It reuses the top bits of the type word to flag Z coordinates, M measures and an embedded SRID, none of which plain WKB carries. That is why a PostGIS point often starts 0101000020 rather than 0101000000.

What does the E6100000 in my hex mean?

It is the SRID, stored little-endian. Read the bytes backwards and you get hex 10E6, which is 4326 — WGS-84 longitude and latitude. Almost every EWKB value you meet from a web mapping stack carries that same SRID.

Why does my geometry decode with the wrong coordinates?

Nearly always a byte-order or truncation problem. If the hex was copied out of a log or wrapped across lines, some bytes may be missing, and this tool reports that rather than printing nonsense. Check that the string length is even and that nothing was cut off the end.

What happens to M values?

GeoJSON positions only carry X, Y and Z, so measure values cannot be represented there and are dropped from the GeoJSON output. The tool still tells you the geometry has M values in the dimensionality stat, so you know they existed in the source.

Related tools