> ## Documentation Index
> Fetch the complete documentation index at: https://docs.e6data.com/llms.txt
> Use this file to discover all available pages before exploring further.

# RTRIM

> Removes trailing characters from a string.

<div className="e6-meta"><span className="e6-eyebrow e6-eyebrow--quiet">Scalar function</span></div>

NULL subject returns NULL; an empty subject remains empty.

## Syntax

### Scalar

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
rtrim(value)
```

### Custom characters (scalar)

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
rtrim(characters, value)
```

* In the two-argument form, pass the characters to remove first and the text to trim second: (characters, subject).

## Arguments

### Scalar

| Name | Type | Required | Description |
| - | - | - | - |
| value | STRING | Yes | String to trim. |

### Custom characters

| Name | Type | Required | Description |
| - | - | - | - |
| characters | STRING | Yes | Set of characters to remove. |
| value | STRING | Yes | String to trim. |

## Returns

* Type: STRING
* NULL behavior: NULL subject returns NULL; an empty subject remains empty.

## Properties

| Property | Value |
| - | - |
| Deterministic | Yes |
| Supports window usage | No |
| Exact result | Yes |

## Usage notes

* The one-argument form removes space characters.
* Deterministic: The same inputs and settings produce the same result.

## Examples

### Typical behavior

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT rtrim('  Hello  ') AS "value";
```

| value |
| - |
| Hello |

### Choose the characters to remove

In the two-argument form, the characters to remove come first.

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT rtrim('.', '..hello..') AS trimmed;
```

| trimmed |
| - |
| ..hello |

## Limitations

* In the two-argument form, pass the characters to remove first and the text to trim second: (characters, subject).

## Related functions

* [trim](/query/sql/functions/string/trim)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.