# Reverse Text

> Write text backwards, flip the order of words in a sentence, turn a list upside down, or reverse the letters inside each word. Emoji stay intact.

Use it online (free, runs in your browser): https://directory.milunir.com/text-tools/text-formatting/reverse-text/

Paste your text and pick how to turn it around. Backwards reads every character from the end, so "Hello, world!" becomes "!dlrow ,olleH". Word order flips words but keeps their spelling, so "the sky is blue" becomes "blue is sky the". Line order puts the last line first.

People reverse text for puzzles, mirror-style usernames, palindrome checks, and for testing how code handles strings. Each job needs a different kind of reversal, so this page offers four: the whole text backwards, the order of words on each line, the order of lines, or the letters inside every word while the words stay put. Characters are counted the way a reader sees them, so a flag emoji or an accented é moves as one piece instead of breaking into stray symbols. Arabic and Hebrew text reverses too, but because those scripts already run right to left, a backwards result can look the same as plain left-to-right writing on screen. The output is plain text, not a special font, so it pastes anywhere.

## How to use

1. **Add the text**: Type, paste, or open a .txt file. Line breaks are kept.
2. **Choose the reversal**: Backwards, Word order, Line order, or Each word.
3. **Copy the result**: The reversed text shows in a box with its own Copy button.

## Examples

### Reverse the words in a sentence

- Your text: the sky is blue
- Reverse: Word order

Result: Reversed text: blue is sky the Characters: 15 Words: 4

Word order flips while each word keeps its spelling, the classic string exercise.

### Backwards text

- Your text: Hello, world!
- Reverse: Backwards

Result: Reversed text: !dlrow ,olleH Characters: 13 Words: 2

Every character, including the comma and exclamation mark, is read from the end to the start.

### Flip a list upside down

- Your text: first second third
- Reverse: Line order

Result: Reversed text: third second first Characters: 18 Words: 3

The last line becomes the first, as the Linux tac command does with a file.

## How it works

`Backwards: output = characters read from last to first, one grapheme cluster at a time; Word order: words on each line rejoined from last to first`

A grapheme cluster is what a reader counts as one character: a letter with its accent, or an emoji built from several code points. Splitting on those clusters, not on raw code units, stops a reversed emoji from turning into broken boxes. Word order splits each line at runs of spaces and joins the words back with single spaces, so punctuation stays glued to its word ("blue." stays "blue."). Line order keeps each line untouched and flips their sequence, like the tac command. Each word reverses every run of non-space characters in place, which keeps spacing exactly as typed.

## When not to use it

- For true mirror writing that flips each letter's shape, you need a mirrored font or image, not reordered characters.
- For sorting a list alphabetically, reversing line order is not the same thing.

## Common mistakes

- Expecting Word order to also reverse punctuation; a full stop stays on the word it was attached to.
- Reversing Arabic text to fix a display problem, which usually makes it read wrong in a correct right-to-left editor.

## Questions

### How do I make backwards text I can copy and paste?

Choose Backwards, type your text, and press Copy on the result box. The output is ordinary characters in reverse order, so it pastes into chats, bios and documents without any special font or app.

### How do I reverse the words in a sentence but keep each word spelled right?

Choose Word order. "the sky is blue" becomes "blue is sky the". Each line is handled on its own, so a paragraph of several lines keeps its line breaks while the words on every line are flipped.

### How do you reverse words in a string, like the LeetCode problem?

LeetCode 151 asks you to split on spaces, drop extra spaces, and join the words in reverse order with single spaces. Word order mode follows the same rule, so you can check your expected output for a test case here before running your Java or Python solution.

### How do I reverse the lines in a file on Linux?

The tac command prints a file's lines from last to first: tac notes.txt. In Vim, :g/^/m0 does the same in the buffer. Without a terminal, open the .txt file here and choose Line order.

### Can I reverse Arabic text?

Yes, the characters are reversed like any other script, and letters with marks move as one piece. Because Arabic is shown right to left, the reversed string may look like left-to-right writing, and joined letter shapes can change at the new word edges.

### Is backwards text the same as a mirror font?

No. Backwards text changes the order of normal letters; each letter still faces the usual way. Mirror text that flips the shape of every letter needs special look-alike Unicode symbols or an image, and many letters have no mirrored version.

## Use from code or an AI agent

Free JSON API, no key needed. The answer is in `result.stats.primary`.

```bash
curl -X POST https://api.tools-directory.workers.dev/v1/tools/reverse-text \
  -H 'Content-Type: application/json' \
  -d '{"inputs":{"text":"the sky is blue","reverse_by":"words"}}'
```

- Inputs (JSON Schema): https://directory.milunir.com/api/v1/tools/reverse-text.json
- MCP server: https://api.tools-directory.workers.dev/mcp (tool `reverse_text`)
- Docs: https://directory.milunir.com/docs/
