---
title: RANDOM_STRING
url: https://www.tines.com/docs/formulas/functions/random-string/
kind: formula-function
---

*[tines.com](https://www.tines.com/llms.txt) › [Docs](https://www.tines.com/docs/llms.txt) › [Formulas](https://www.tines.com/llm/docs/formulas.md) › [Functions](https://www.tines.com/llm/docs/formulas/functions.md)*

# RANDOM_STRING

*[View on tines.com](https://www.tines.com/docs/formulas/functions/random-string/)*

Returns a string of random characters. The function takes three optional arguments: length, mode, and custom.

length determines the length of the string (default 16).

mode determines the type of characters in the string. The options are "alphanumeric", "custom", "hex", "letters", "numbers" (default "alphanumeric").

The custom_characters argument is only used when mode is set to "custom". It is a string of characters that will be used to generate the random string.

**Categories:** Text

## Syntax

```
RANDOM_STRING(length, mode, custom_characters)
```

## Examples

### Example 1: Returns a string of random upper and lowercase letters and numbers (a-z, A-Z, and 0-9).

Formula:

```
RANDOM_STRING()
```

Output:

```json
"aBcDeFgH12345678"
```

### Example 2: Returns a string of random alphanumeric characters of set length.

Formula:

```
RANDOM_STRING(32)
```

Output:

```json
"aBcDeFgHiJkLmNoP1234567890123456"
```

### Example 3: In "hex" mode, returns a string of random lowercase hexadecimal characters (0-9 and a-f).

Formula:

```
RANDOM_STRING(16, "hex")
```

Output:

```json
"aa1bb2cc3dd4ee5f"
```

### Example 4: In "letters" mode, returns a string of random uppercase and lowercase letters (a-z and A-Z).

Formula:

```
RANDOM_STRING(52, "letters")
```

Output:

```json
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
```

### Example 5: In "numbers" mode, returns a string of random digits (0-9).

Formula:

```
RANDOM_STRING(32, "numbers")
```

Output:

```json
"01234567890123456789012345678901"
```

### Example 6: In "custom" mode, returns a string of random characters from the provided string.

Formula:

```
RANDOM_STRING(10, "custom", "abc123")
```

Output:

```json
"a1b2c3a2c1"
```

### Example 7: "custom" mode also accepts special characters and emojis.

Formula:

```
RANDOM_STRING(10, "custom", "a1&👍")
```

Output:

```json
"a1&👍👍&1a&1"
```
