---
schema_version: "1"
id: c75c3c5c192a88ac074e27d73acb302095c56a513ce8bd398c7dc8bfeef58e96
title: RTRIM
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/data-cloud/data-cloud-query-guide/references/data-cloud-sql-reference/scalar-func/string-func/rtrim.md
canonical_url: https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/rtrim.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: f3c8f67782c993d81d069f02566480a08fa500ed42ad62dd7daf3e6901a438af
products:
  - Data 360 Query Guide
  - Data 360 Developer Documentation
---
# `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](https://developer.salesforce.com/docs/data/data-cloud-query-guide/datatype/string.md)
