> ## 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](/reference/wherobots-db/geometry-data/box2d/ST_Box2D); it always returns a `Box3D` value that serializes to a struct of six non-nullable doubles and round-trips through Parquet without WKB overhead.

<img src="https://mintcdn.com/wherobots/XpQVzmvmMISOboEb/images/sql-functions/box3d/st_box3d.svg?fit=max&auto=format&n=XpQVzmvmMISOboEb&q=85&s=1ebf5e76c2934a82093ee385702afdce" alt="ST_Box3D returns the tightest cuboid enclosing a geometry" width="340" height="250" data-path="images/sql-functions/box3d/st_box3d.svg" />

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

<ParamField body="geom" type="Geometry" required>
  The geometry whose 3D bounding box is returned.
</ParamField>

## Return type

<ResponseField type="Box3D">
  The 3D bounding box as a `Box3D` value.
</ResponseField>

## 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)
```
