WKT Viewer & WKB Converter
View and convert Well-Known Text (WKT) and Well-Known Binary (WKB) geometries
What Are WKT and WKB?
Well-Known Text (WKT) and Well-Known Binary (WKB) are two standardised formats for representing vector geometry, defined by the Open Geospatial Consortium and used throughout the spatial database world. WKT is a human-readable text format that looks like POINT (30 10) or POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10)). WKB is the same information encoded as a compact binary string, usually displayed as hex like 0101000000000000000000F03F0000000000000040. Both formats are supported by PostGIS, Oracle Spatial, MySQL, SQL Server, GEOS, Shapely, JTS, and almost every spatial library worth knowing.
The WKT Viewer & WKB Converter on gis.tools is a free, browser-based tool for parsing, visualising, and converting between WKT, WKB, and GeoJSON. Paste a WKT string from a SQL query, drop a WKB hex blob from a database export, or upload a GeoJSON file β the tool parses it, renders it on a map, and lets you switch formats freely. Everything runs locally in your browser, so you can safely paste in geometries from production databases without worrying about leaking sensitive data.
How WKT and WKB Differ
WKT is meant to be read and written by humans. It uses the geometry type name followed by parenthesised coordinate lists. The full grammar is in OGC Simple Features. WKB is meant for storage and transmission: it's a binary format with a one-byte byte-order flag, a four-byte geometry type code, and packed double-precision coordinates. WKB is faster to parse and more compact, which is why databases prefer it internally and convert to WKT only for display.
There's also EWKT and EWKB, PostGIS extensions that add an SRID prefix (SRID=4326;POINT(30 10)) so the spatial reference travels with the geometry. The viewer recognises both standard and extended variants.
Geometry Types Supported
The parser handles all OGC Simple Features types: Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon, and GeometryCollection. It also handles 3D variants (POINT Z, POINT ZM) and CIRCULARSTRING/COMPOUNDCURVE if present in the input.
How the Tool Works
The viewer detects the input format by inspecting the first few characters: a leading geometry name like POINT indicates WKT; a leading 00 or 01 byte (in hex) indicates WKB; a { indicates GeoJSON. It parses the input into an internal geometry tree, projects to WGS84 for display if an SRID is provided, and renders the result on the preview map.
From that internal representation it can emit any of the supported formats. Round-tripping WKT β GeoJSON β WKT is lossless except for SRID information, which only WKT/EWKT and GeoJSON's optional CRS member can carry.
Practical Applications
SQL Database Debugging
A developer running PostGIS queries gets back geometry columns as WKT or hex WKB. Pasting them into the viewer is the fastest way to confirm that the query returned what they expected.
Spatial SQL Learning
Students learning PostGIS, SpatiaLite, or Oracle Spatial need to visualise the geometries their queries are producing. The viewer is a frictionless companion to a SQL console.
Database Export Inspection
When migrating data between spatial databases, exports often arrive as CSV files with a WKT geometry column. Picking a few rows and pasting them into the viewer is the quickest sanity check.
API Development
APIs that return spatial data sometimes use WKT (notably the OGC API Features standard). Front-end developers consuming these APIs use the viewer to verify that their parsing logic produces the right shapes.
GIS Education
Instructors teaching the OGC Simple Features specification want a tool where students can type a WKT string and immediately see the corresponding shape. The viewer is built for this.
Bug Reproduction
Filing a bug report against a spatial library is much easier when you can attach a minimal WKT string that reproduces the problem. The viewer helps you whittle a complex geometry down to a minimal example.
Step-by-Step Workflow in gis.tools
- Open the WKT Viewer & WKB Converter page.
- Paste a WKT string, a WKB hex blob, or a GeoJSON snippet into the input box.
- The viewer auto-detects the format and renders the geometry on the preview map.
- Use the format toggle to switch the output to WKT, WKB, or GeoJSON.
- Copy the converted text to your clipboard, or download it as a file.
- Repeat for additional geometries β the viewer keeps a history of recent inputs.
Worked Example
A developer is debugging a PostGIS query that returns the union of three census tracts. The query returns a single hex WKB string about 4 KB long. They paste it into the viewer; the binary parser reads it as a MultiPolygon containing 14 rings spanning a small area in northern Minnesota. The viewer also reports the bounding box and centroid.
They switch the output to WKT to copy a human-readable version into a bug report. Then they switch to GeoJSON and download the result for use in a Leaflet test page. Total time: about 90 seconds, all without leaving the browser.
Common Pitfalls and Gotchas
- Endianness β WKB has a leading byte that flags little-endian (01) or big-endian (00). Mixing these up produces nonsense.
- EWKB vs WKB β PostGIS's extended WKB has an SRID embedded; standard WKB does not. Tools that don't recognise EWKB will misinterpret it.
- Coordinate order β WKT and WKB use longitude-latitude (x, y), the same as GeoJSON. Some database tools mistakenly display lat/lon order.
- Z and M dimensions β POINT Z has three coordinates per vertex; POINT ZM has four. Parsers must know which dimension flag is set.
- SRID handling β Without an SRID, the viewer assumes WGS84 for display, which may be wrong.
- Polygon ring winding β WKT/WKB don't enforce a winding rule, but GeoJSON does. Round-tripping may rewind your rings.
- Curves and arcs β CIRCULARSTRING and COMPOUNDCURVE are valid OGC types but not supported by GeoJSON; round-tripping linearises them.
Tips for Best Results
- Include an SRID when pasting WKT from PostGIS (
SRID=4326;POINT(...)). - For very long WKB strings, use the file upload option instead of pasting.
- Verify the bounding box on the preview matches the area you expect.
- For repeated debugging sessions, use the history panel to switch between inputs.
- Pair with the GeoJSON Validator & Fixer when round-tripping into the GeoJSON ecosystem.
- Use the CRS Metadata Inspector when an SRID is involved but unfamiliar.
Comparison with Other GIS Approaches
Desktop GIS like QGIS can paste WKT into the Add Layer from WKT dialog but not WKB. PostGIS's ST_AsText and ST_GeomFromText are the canonical conversion functions but require a database connection. Python's Shapely and JavaScript's Turf.js can parse WKT in code, but you still need somewhere to view the result. The browser-based viewer is the fastest path for one-off, interactive inspection of WKT/WKB blobs.
Performance Considerations
WKT can become huge β a single MultiPolygon with millions of vertices easily reaches tens of megabytes. The viewer handles up to a few hundred megabytes of input on a desktop browser, which is enough for almost any single-geometry case. WKB is more compact, so the same geometry takes about half as much space.
Data Privacy and Browser-Based Processing
WKT and WKB strings often come straight from production databases and may contain sensitive coordinates β facility locations, customer addresses, asset positions. Everything in the viewer runs locally; nothing is sent anywhere. Paste freely.
Related GIS Concepts
OGC Simple Features β The specification that defines WKT, WKB, and the standard geometry type model used across spatial databases.
EWKB and EWKT β PostGIS extensions that add SRID information to the standard formats.
TWKB (Tiny WKB) β A more compact binary format with variable-precision coordinates, used for transmitting geometry in mobile applications.
GeoJSON β The web-friendly JSON alternative defined in RFC 7946. Comparable expressive power for most use cases.
Frequently Asked Questions
Can I paste a list of WKT strings, one per line?
Yes β the viewer treats each line as a separate geometry and renders them all on the map.
Why does my WKB string fail to parse?
Usually it's an endianness or EWKB-vs-WKB mismatch. Try the alternate decoding mode in the settings.
Does the viewer support 3D geometries?
Yes β POINT Z, LINESTRING Z, POLYGON Z, and ZM variants all parse, though the preview only shows 2D.
Can I export multiple geometries to a single GeoJSON FeatureCollection?
Yes β paste multiple WKT lines and download as a FeatureCollection.
Related Tools on gis.tools
Related Tools
View All ToolsGeoTIFF Tiles Preview
Preview GeoTIFF as PNG tiles with client-side tiling
Import & ExportCSV to Points Layer
Build a points layer from CSV with latitude/longitude columns
Import & ExportPMTiles/MBTiles Inspector
Inspect PMTiles and MBTiles files: bounds, zoom levels, layer names
Import & ExportShapefile Viewer & Converter (to GeoJSON)
Convert Shapefile (.shp, .dbf, .prj) to GeoJSON format in your browser
Import & ExportMap Style Converter
Convert between Mapbox style JSON and simplified style schemas
Import & ExportCoordinate Precision Reducer
Reduce coordinate decimal precision to shrink file sizes
Import & Export100% client-side processing - your data stays private and never leaves your device