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

# PostgreSQL ASCII() Function

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