> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wherobots.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ST_Box3D

Returns the planar 3D bounding box of a geometry as a typed `Box3D` value (six doubles: `xmin`, `ymin`, `zmin`, `xmax`, `ymax`, `zmax`).

Geometries without a Z dimension fold into `zmin = zmax = 0`, matching PostGIS. `ST_Box3D` is the 3D counterpart to [ST\_Box2D](https://docs.wherobots.com/reference/wherobots-db/geometry-data/box2d/ST_Box2D.md); it always returns a `Box3D` value that serializes to a struct of six non-nullable doubles and round-trips through Parquet without WKB overhead.

![ST\_Box3D returns the tightest cuboid enclosing a geometry](https://mintcdn.com/wherobots/XpQVzmvmMISOboEb/images/sql-functions/box3d/st_box3d.svg?fit=max\&auto=format\&n=XpQVzmvmMISOboEb\&q=85\&s=1ebf5e76c2934a82093ee385702afdce)

It is also produced by the SQL cast `CAST(geom AS box3d)`.

Returns `NULL` for `NULL` or empty geometry input.

## Signatures

```sql theme={"system"}
ST_Box3D(geom: Geometry)
```

## Parameters

**geom** `Geometry` *required*

The geometry whose 3D bounding box is returned.

## Return type

The 3D bounding box as a `Box3D` value.

## Example

```sql theme={"system"}
SELECT ST_AsText(ST_Box3D(ST_GeomFromWKT('LINESTRING Z(0 0 -3, 5 10 7)')))
```

```
BOX3D(0.0 0.0 -3.0, 5.0 10.0 7.0)
```

A 2D geometry folds its Z extent to 0:

```sql theme={"system"}
SELECT ST_AsText(ST_Box3D(ST_GeomFromWKT('LINESTRING (0 0, 5 10)')))
```

```
BOX3D(0.0 0.0 0.0, 5.0 10.0 0.0)
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.