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

# PostgreSQL UPPER() Function

**Info:** The UPPER() function works the same way across any PostgreSQL deployment, so everything here applies whether you're running Postgres locally, on another provider, or in the cloud. If you're an enterprise standardizing on managed Postgres for the AI era, [Lakebase](https://www.databricks.com/product/lakebase) delivers a secure, high-performance database fully integrated with the Lakehouse. If you're a developer or startup that needs to ship features and scale on demand, [Neon](https://neon.com) gives you the fastest path from idea to production on Postgres.

**Summary**: in this tutorial, you will learn how to use the PostgreSQL `UPPER()` function to convert a string to uppercase.

## Introduction to the PostgreSQL UPPER() function

The `UPPER()` function converts a string to uppercase based on the rules of the database's locale.

Here's the syntax of the `UPPER()` function:

```sql
UPPER(text)
```

In this syntax, `text` is the input string that you want to convert to uppercase. Its type can be `CHAR`, [`VARCHAR`](../postgresql-tutorial/postgresql-char-varchar-text), or `TEXT`.

The `UPPER()` function returns a new string with all letters converted to uppercase.

The `UPPER()` function returns `NULL` if the `text` is `NULL`.

Note that to convert a string to lowercase, you use the [LOWER()](https://neon.com/postgresql/string-functions/postgresql-lower) function.

## PostgreSQL UPPER() function examples

Let's take some examples of using the `UPPER()` function.

### 1) Basic PostgreSQL UPPER() function example

The following example uses the `UPPER()` function to convert the string `PostgreSQL` to uppercase:

```sql
SELECT UPPER('PostgreSQL');
```

Output:

```text
   upper
------------
 POSTGRESQL
(1 row)
```

### 2) Using PostgreSQL UPPER() function with table data

We'll use the `customer` table from the [sample database](../postgresql-getting-started/postgresql-sample-database):

![PostgreSQL UPPER() Function - Sample Table ](https://neon.com/postgresqltutorial/customer.png)The following example uses the `UPPER()` function to convert the first names of customers to uppercase:

```sql
SELECT
  UPPER(first_name)
FROM
  customer
ORDER BY
  first_name;
```

Output:

```text
    upper
-------------
 AARON
 ADAM
 ADRIAN
 AGNES
 ALAN
...
```

### 3) Using PostgreSQL UPPER() function in the WHERE clause

The following example uses the `UPPER()` function in the [`WHERE`](../postgresql-tutorial/postgresql-where) clause to find customers by last names, comparing them with the input string in uppercase:

```sql
SELECT
  first_name,
  last_name
FROM
  customer
WHERE
  UPPER(last_name) = 'BARNETT';
```

Output:

```text
 first_name | last_name
------------+-----------
 Carole     | Barnett
(1 row)
```

## Summary

- Use the `UPPER()` function to return a new string with all the characters of the input string converted to uppercase.

---

## Related docs (String Functions)

- [ASCII](https://neon.com/postgresql/string-functions/ascii)
- [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)
