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

> ## Agent Instructions
> FalkorDB is a graph database that speaks the Redis protocol. Queries are issued as OpenCypher through the GRAPH.QUERY and GRAPH.RO_QUERY commands, not over Bolt or a SQL connection.
> FalkorDB implements a subset of OpenCypher with proprietary extensions. Do not assume Neo4j-only syntax or procedures are available — check /cypher/cypher-support and /cypher/known-limitations before using a clause.
> FalkorDB is the successor to RedisGraph, but they are separate products. Do not present RedisGraph commands, versions, or limitations as current FalkorDB behavior.
> Use the official clients listed in /getting-started/clients rather than generic Redis or Neo4j drivers, and prefer the language the user is already working in.
> Configuration parameters are set with GRAPH.CONFIG SET or at startup; cite the exact parameter name from /getting-started/configuration rather than inventing one.
> This site covers four products: FalkorDB (core), FalkorDB Cloud, FalkorDB Enterprise, and the GraphRAG SDK. Name which one an answer applies to, since setup and operations differ.

# text.rpad

> Pads the right side of a string with a specified character until it reaches a desired length.

## Description

Pads the end (right side) of a string with a specified character until it reaches the desired length.

## Syntax

```cypher theme={null}
flex.text.rpad(string, length, padChar)
```

## Parameters

| Parameter | Type          | Required | Description                                               |
| --------- | ------------- | -------- | --------------------------------------------------------- |
| `string`  | string/number | Yes      | The string to pad (will be converted to string if number) |
| `length`  | number        | Yes      | The target length after padding                           |
| `padChar` | string        | No       | The character to use for padding (default: space ' ')     |

## Returns

**Type:** string

The padded string. If the original string is already longer than the target length, it is returned unchanged. Returns `null` if input is `null`.

## Examples

### Example 1: Basic Right Padding

```cypher theme={null}
RETURN flex.text.rpad('test', 8, '-') AS result
```

**Output:**

```text theme={null}
result
----------
test----
```

### Example 2: Creating Fixed-Width Fields

```cypher theme={null}
MATCH (p:Product)
RETURN flex.text.rpad(p.name, 20, ' ') AS productName, p.price
```

**Output:**

```text theme={null}
productName          | price
---------------------|-------
Laptop               | 999.99
Mouse                | 29.99
```

### Example 3: Building Formatted Tables

```cypher theme={null}
WITH [['Name', 15], ['Email', 25], ['Role', 10]] AS columns
UNWIND columns AS col
RETURN flex.text.rpad(col[0], col[1], ' ') AS header
```

## Notes

* Returns `null` if input is `null`
* Converts numbers to strings automatically
* Default padding character is a space
* If string is already longer than target length, returns original string
* Useful for creating aligned columns, fixed-width output, or formatted tables

## See Also

* [text.lpad](/udfs/flex/text/lpad) - Pad the start (left side) of a string
* [text.repeat](/udfs/flex/text/repeat) - Repeat a string multiple times
* [text.format](/udfs/flex/text/format) - Format strings with placeholders

## Frequently Asked Questions

<AccordionGroup>
  <Accordion title="What happens if the string is already longer than the target length?">
    The original string is returned unchanged — no truncation occurs.
  </Accordion>

  <Accordion title="What is the default padding character?">
    The default padding character is a space `' '` if no `padChar` argument is provided.
  </Accordion>
</AccordionGroup>
