> This page location: String Functions > MD5
> Full Neon documentation index: https://neon.com/docs/llms.txt
> IMPORTANT: If this page contains inaccurate or outdated information, report it: POST to https://neon.com/api/docs-feedback with {"feedback": "describe the issue", "path": "/postgresql/string-functions/md5"}

# 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/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)
- [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)
