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

# ST_AsText, ST_AsWKT

> Converts a GEOMETRY or GEOGRAPHY value to WKT (Well-Known Text).

Converts a native spatial value or a legacy encoded shape to Well-Known Text (WKT). `ST_AsWKT` is an alias of `ST_AsText`.

## Syntax

### Native overloads

```sql theme={null}
VARCHAR ST_AsText(GEOMETRY geo)
VARCHAR ST_AsText(GEOGRAPHY geography)
VARCHAR ST_AsWKT(GEOMETRY geo)
VARCHAR ST_AsWKT(GEOGRAPHY geography)
```

For native `GEOMETRY` and `GEOGRAPHY`, the function preserves all seven OGC geometry families, `EMPTY`, and empty children. A `NULL` input returns `NULL`. The serializer does not change the input CRS or coordinates.

### Legacy overloads

```sql theme={null}
VARCHAR ST_AsText(VARCHAR shape)
VARCHAR ST_AsWKT(VARCHAR shape)
```

These overloads accept encoded shapes from legacy constructors such as [ST\_Point](/documents/4.2/sql-reference/sql-functions/spatial-functions/st_point.md).

## Examples

### Native examples

```SQL theme={null}
SELECT ST_AsText(ST_GeogFromText('GEOMETRYCOLLECTION (POINT EMPTY, LINESTRING (1 2, 3 4))'));
```

```text theme={null}
GEOMETRYCOLLECTION (POINT EMPTY, LINESTRING (1 2, 3 4))
```

```SQL theme={null}
SELECT ST_AsText(ST_GeomFromText('POINT (1000000 2000000)', 'EPSG:3857'));
```

```text theme={null}
POINT (1000000 2000000)
```

### Legacy example

```Plain Text theme={null}
MySQL > SELECT ST_AsText(ST_Point(24.7, 56.7));
+---------------------------------+
| st_astext(st_point(24.7, 56.7)) |
+---------------------------------+
| POINT (24.7 56.7)               |
+---------------------------------+
```

## keyword

ST\_ASTEXT, ST\_ASWKT, ST, ASTEXT, ASWKT

## Related data types

[GEOGRAPHY](/documents/4.2/sql-reference/data-types/spatial-types/GEOGRAPHY.md), [GEOMETRY](/documents/4.2/sql-reference/data-types/spatial-types/GEOMETRY.md), [VARCHAR](/documents/4.2/sql-reference/data-types/string-type/VARCHAR.md)


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