WKB to WKT Converter
Turning the binary geometry a spatial database stores back into text you can read, diff, or paste into a GIS.
Common issues converting WKB to WKT
- Supply hex-encoded WKB (the usual 0101000000… form). If you have raw bytea, hex-encode it first with encode(geom,'hex').
- EWKB inputs carry an SRID prefix; the converter reads it, but standard WKT can't express an SRID, so it's surfaced separately rather than inlined.
- Output coordinate precision matches the doubles in the binary — long decimals are expected, not an error. Round them downstream if needed.
- A WKB blob has no attribute columns, so the WKT output is one geometry per record with no properties table.
Frequently asked questions
My hex starts with 0101000020 — what's the 20?
That's the EWKB SRID flag. The bytes after it encode the SRID (for example 4326). The converter detects and reports it.
Are both byte orders supported?
Yes — big-endian (XDR) and little-endian (NDR) are auto-detected from the first byte.
Can I convert many rows at once?
Yes. Supply one WKB hex per line or record and each becomes a WKT geometry.
Is the conversion lossless?
Yes. WKB→WKT preserves every coordinate exactly; only the SRID can't live inside plain WKT.