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

# PostgreSQL MD5() Function

The PostgreSQL `MD5()` function calculates the [MD5](https://en.wikipedia.org/wiki/MD5) hash of a string and returns the result in hexadecimal.

## Syntax

The following illustrates the syntax of the `MD5()` function:

```sql
MD5(string)
```

## Arguments

The `MD5()` function accepts one argument.

**1) `string`**

The `string` argument is the string of which the MD5 hash is calculated.

## Return value

The `MD5()` function returns a string in [`TEXT`](../postgresql-tutorial/postgresql-char-varchar-text) data type.

## Examples

The following example shows how to use the `MD5()` function to return the MD5 hash of the message `'PostgreSQL MD5'`:

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

The result is:

```
        md5
----------------------------------
 f78fdb18bf39b23d42313edfaf7e0a44
(1 row)
```

In this tutorial, you have learned how to use the PostgreSQL `MD5()` function to calculate the MD5 hash of a string.

---

## Related docs (String Functions)

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