<!-- https://learnsql.cpetoday.com/functions/m/text-reverse -->
# Text.Reverse

Language: Power Query M
Category: Text
Syntax: Text.Reverse(text as nullable text) as nullable text
Summary: Returns the characters of a text value in reverse order.
Returns: The reversed text, or null when the input is null.
Level: Intermediate
Related: Text.End, Text.Start, Text.ToList, Text.Length, Text.Middle

## What it does
Text.Reverse flips the characters of a value. On its own it is rarely needed in a finance report, but it is a short way to find the last occurrence of something in a string, or to read a code from the right. It is the M equivalent of the reversal trick people use in spreadsheets.
## Syntax and arguments
- text: the value to reverse. There are no other arguments.
## Example
A data team wants the file extension of a bank file name without knowing how long the base name is. Reversing the name makes the extension the first part.

```powerquery
let
    FileName = "stmt_2026_09.csv",
    Reversed = Text.Reverse(FileName),
    ExtReversed = Text.BeforeDelimiter(Reversed, "."),
    Extension = Text.Reverse(ExtReversed)
in
    Extension
```

Reversed is "vsc.90_6202_tmts". The text before the first dot in that reversed value is "vsc", and reversing it again gives "csv". The result is "csv".
## Example: a second, different use
Check a check digit by reversing an account number and testing each digit from the right.
## Things to watch
- Reverse only short codes. Free text such as a memo reads badly in reverse and is not worth the trouble.
- For a file extension, a simpler rule is often better, such as checking the end with Text.EndsWith.
- The result is text. Convert with Number.FromText if the reversed value is a number.
- Null in gives null out.
## In business terms
Reversal is rarely the right tool in a finance report. It is useful for odd cases such as reading a suffix from a long code, or for check digit logic in a bank or tax number.
