# `RTRIM`

**Applies to:** ✅ Data 360 SQL ✅ Tableau Hyper API

Removes specified characters from the end of a string.

## Syntax

```sql
rtrim(<string> [, characters])
```

## Arguments

### Required

- `<string>`: The string to trim.

### Optional

- `characters`: The characters to remove. Defaults to space.

## Returns

Returns a text value with specified characters removed from the end.

## Considerations

- Removes individual characters from the set, not as a substring pattern.
- Continues removing until encountering a character not in the set.

## Examples

### Right Trim

Remove characters from the end.

```sql
SELECT rtrim('testxxzx', 'xyz') AS result;
```

Returns `'test'`.

## Related Documentation

- [String Types](/docs/data/data-cloud-query-guide/references/dc-sql-reference/string.md)
