# INET6\_ATON

## Syntax

```sql
INET6_ATON(expr)
```

## Description

Given an IPv6 or IPv4 network address as a string, returns a binary string that represents the numeric value of the address.

No trailing zone ID's or traling network masks are permitted. For IPv4 addresses, or IPv6 addresses with IPv4 address parts, no classful addresses or trailing port numbers are permitted and octal numbers are not supported.

The returned binary string will be [VARBINARY(16)](https://mariadb.com/docs/server/reference/data-types/string-data-types/varbinary) or [VARBINARY(4)](https://mariadb.com/docs/server/reference/data-types/string-data-types/varbinary) for IPv6 and IPv4 addresses respectively.

Returns `NULL` if the argument is not understood.

**MariaDB starting with** [**10.5.0**](https://app.gitbook.com/s/aEnK0ZXmUbJzqQrTjFyb/community-server/old-releases/10.5/10.5.0)

{% tabs %}
{% tab title="Current" %}
`INET6_ATON` can take [INET6](https://mariadb.com/docs/server/reference/data-types/string-data-types/inet6) as an argument.
{% endtab %}

{% tab title="< 10.5" %}
`INET6_ATON` **cannot** take [INET6](https://mariadb.com/docs/server/reference/data-types/string-data-types/inet6) as an argument.
{% endtab %}
{% endtabs %}

## Examples

```sql
SELECT HEX(INET6_ATON('10.0.1.1'));
+-----------------------------+
| HEX(INET6_ATON('10.0.1.1')) |
+-----------------------------+
| 0A000101                    |
+-----------------------------+

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

## See Also

* [INET6\_NTOA()](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/inet6_ntoa)
* [INET\_ATON()](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/inet_aton)
* [INET6](https://mariadb.com/docs/server/reference/data-types/string-data-types/inet6) Data Type

<sub>*This page is licensed: CC BY-SA / Gnu FDL*</sub>

{% @marketo/form formId="4316" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/inet6_aton.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
