> This page location: String Functions > ASCII
> Full Neon documentation index: https://neon.com/docs/llms.txt

# PostgreSQL ASCII() Function

**Info:** The `ASCII()` function works the same across any PostgreSQL deployment, so you can apply what you learn here on Postgres anywhere you run it. If you're an enterprise building for the AI era, [Lakebase](https://www.databricks.com/product/lakebase) delivers the most performant, secure managed Postgres, fully integrated into the Lakehouse. If you're a developer or startup who needs to ship and scale fast, [Neon](https://neon.com) gives you the best Postgres platform to do it.

The PostgreSQL `ASCII()` function returns an [ASCII](https://en.wikipedia.org/wiki/ASCII) code value of a character. In the case of UTF-8, the `ASCII()` function returns the Unicode code point of the character.

## Syntax

The following illustrates the syntax of ASCII function:

```sql
ASCII(char)
```

## Arguments

The `ASCII()` function requires one argument:

**1) `char`**

The `char` argument is a [character](../postgresql-tutorial/postgresql-char-varchar-text) that you want to get the ASCII code.

If you pass a string to the `ASCII()` function, it will return the ASCII code of the first character.

## Return value

The `ASCII()` function returns an integer that represents the ASCII code value of the input character. In the case of a UTF-8 character, it returns an integer which is corresponding to the Unicode code point.

## Examples

The following example uses the `ASCII()` function to get the ASCII code values of the character `A` and `a`:

```sql
SELECT
    ASCII( 'A' ),
    ASCII( 'a' );
```

The output is:

![PostgreSQL ASCII function example](https://neon.com/postgresqltutorial/PostgreSQL-ASCII-function-example.png)
If you pass a sequence of characters to the `ASCII()` function, you will get the ASCII code of the first character as shown in the following example:

```sql
SELECT
    ASCII( 'ABC' );
```

The function returns the ASCII code of the letter A which is 65 as follows:

![PostgreSQL ASCII function - string example](https://neon.com/postgresqltutorial/PostgreSQL-ASCII-function-string-example.png)
The following example illustrates how to use the `ASCII()` function to get the Unicode code point of a UTF-8 character:

```sql
 SELECT
    ASCII( 'Ω' );
```

![PostgreSQL ASCII function - unicode example](https://neon.com/postgresqltutorial/PostgreSQL-ASCII-function-unicode-example.png)

## Remarks

To get the ASCII code value or Unicode code point of an integer, you use the [`CHR()`](https://neon.com/postgresql/string-functions/postgresql-chr) function.

In this tutorial, you have learned how to use the PostgreSQL `ASCII()` function to get the ASCII code or Unicode code point of a character.

---

## Related docs (String Functions)

- [CHR](https://neon.com/postgresql/string-functions/chr)
- [CONCAT](https://neon.com/postgresql/string-functions/concat-function)
- [CONCAT_WS](https://neon.com/postgresql/string-functions/concat_ws)
- [FORMAT](https://neon.com/postgresql/string-functions/format)
- [INITCAP](https://neon.com/postgresql/string-functions/initcap)
- [LEFT](https://neon.com/postgresql/string-functions/left)
- [LENGTH](https://neon.com/postgresql/string-functions/length-function)
- [LOWER](https://neon.com/postgresql/string-functions/lower)
- [LPAD](https://neon.com/postgresql/string-functions/lpad)
- [LTRIM](https://neon.com/postgresql/string-functions/ltrim)
- [MD5](https://neon.com/postgresql/string-functions/md5)
- [POSITION](https://neon.com/postgresql/string-functions/position)
- [REGEXP_MATCHES](https://neon.com/postgresql/string-functions/regexp_matches)
- [REGEXP_REPLACE](https://neon.com/postgresql/string-functions/regexp_replace)
- [REPEAT](https://neon.com/postgresql/string-functions/repeat)
- [REVERSE](https://neon.com/postgresql/string-functions/reverse)
- [REPLACE](https://neon.com/postgresql/string-functions/replace)
- [RIGHT](https://neon.com/postgresql/string-functions/right)
- [RPAD](https://neon.com/postgresql/string-functions/rpad)
- [RTRIM](https://neon.com/postgresql/string-functions/rtrim)
- [SPLIT_PART](https://neon.com/postgresql/string-functions/split_part)
- [SUBSTRING](https://neon.com/postgresql/string-functions/substring)
- [TO_CHAR](https://neon.com/postgresql/string-functions/to_char)
- [TO_NUMBER](https://neon.com/postgresql/string-functions/to_number)
- [TRANSLATE](https://neon.com/postgresql/string-functions/translate)
- [TRIM](https://neon.com/postgresql/string-functions/trim-function)
- [UPPER](https://neon.com/postgresql/string-functions/upper)
