# INET6\_ATON

Converts an IPv6 or IPv4 internet address from its text representation to its binary representation.

## Syntax

```sql
INET6_ATON ( string )

```

## Arguments

* string: IPv6 or IPv4 network address as a string

## Return Type

Binary string.

The length of the returned binary string will be 16 or 4 for IPv6 and IPv4 addresses respectively.

Returns NULL if the address is NULL or invalid.

## Examples

```sql
SELECT HEX(INET6_ATON('10.0.1.1'));

```

```output

+-----------------------------+
| HEX(INET6_ATON('10.0.1.1')) |
+-----------------------------+
| 0A000101                    |
+-----------------------------+

```

```sql
SELECT HEX(INET6_ATON('48f3::d432:1431:ba23:846f'));

```

```output

+----------------------------------------------+
| HEX(INET6_ATON('48f3::d432:1431:ba23:846f')) |
+----------------------------------------------+
| 48F3000000000000D4321431BA23846F             |
+----------------------------------------------+

```

```sql
SELECT INET6_NTOA(INET6_ATON('2001:db8:8714:3a90::12'));

```

```output

+--------------------------------------------------+
| INET6_NTOA(INET6_ATON('2001:db8:8714:3a90::12')) |
+--------------------------------------------------+
| 2001:db8:8714:3a90::12                           |
+--------------------------------------------------+

```

```sql
SELECT HEX(INET6_ATON(INET6_NTOA(UNHEX('48F3000000000000D4321431BA23846F'))));

```

```output

+------------------------------------------------------------------------+
| HEX(INET6_ATON(INET6_NTOA(UNHEX('48F3000000000000D4321431BA23846F')))) |
+------------------------------------------------------------------------+
| 48F3000000000000D4321431BA23846F                                       |
+------------------------------------------------------------------------+

```

## Related Topics

* [INET6\_NTOA](https://docs.singlestore.com/db/v9.1/reference/sql-reference/string-functions/inet-6-ntoa.md)

***

Modified at: February 27, 2023

Source: [/db/v9.1/reference/sql-reference/string-functions/inet-6-aton/](https://docs.singlestore.com/db/v9.1/reference/sql-reference/string-functions/inet-6-aton/)

(An index of the documentation is available at /llms.txt)
