InputTestHub

RTL and Bidi Text Checker

Shows how right-to-left text renders against how it is stored, and finds unmatched embeddings, isolates and the trojan-source pattern.

Lab Nothing uploaded No sign-up Free, unlimited
Lab tool
Paste something on the left to see the result.
In short Right-to-left text does not simply run backwards; the Unicode bidirectional algorithm decides direction character by character, and the results are frequently counter-intuitive. The base direction of a paragraph comes from its first strong character, and neutral characters — punctuation, spaces, digits — take their direction from their neighbours. That is why a full stop at the end of an Arabic sentence containing an English phrase can jump to what looks like the wrong side: it is neutral, and it inherits from whichever text surrounds it rather than from the sentence as a whole. This shows the stored order against the rendered order so the difference is visible rather than mysterious. For controlling it, the isolate characters U+2066 to U+2069 are preferred over the older embedding characters, because an isolate stops the enclosed text from influencing the direction of what is around it, which is precisely the bug embeddings cause. The security case is trojan source, CVE-2021-42574: directional overrides can make source code display in an order completely different from the order the compiler reads, so a line that appears to be a comment is executable and vice versa. Any unmatched or unnecessary directional control in code is worth treating as hostile until explained.

How to use the RTL and Bidi Text Checker

  1. Paste your text into the input box on the left.
  2. Adjust the options above the box if you need a different behaviour.
  3. The converted text appears on the right; press Copy to put it on your clipboard.

About the RTL and Bidi Text Checker

The RTL and Bidi Text Checker shows how right-to-left text renders against how it is stored, and finds unmatched embeddings, isolates and the trojan-source pattern. It runs as plain JavaScript inside the page, which means there is no upload step, no queue and no size limit imposed by a server — the only limit is your own device.

What people use it for

  • Debugging Arabic or Urdu text that renders in the wrong order.
  • Checking pasted source code for a trojan-source attack.
  • Understanding why punctuation jumps sides in mixed text.

Details

Base directionSet by the first strong character
NeutralsTake direction from their neighbours
Isolates U+2066-2069Preferred over embeddings
Trojan sourceCVE-2021-42574
Two panelsRendered order and stored order

The maths behind it

This tool uses embeddings and isolates are matched as a stack: every LRE, RLE, LRO and RLO needs a PDF, and every LRI, RLI and FSI needs a PDI. An unbalanced stack leaks direction into the text that follows. Every intermediate value is shown on screen, so the result can be checked by hand.

This is a structural check, not a character list — the Invisible Character Detector already names every direction override present. What it adds is whether those characters are balanced, what the base direction resolves to, and where neutral punctuation sits between two opposite runs.

Where this tool stops

The preview uses your browser's own bidi implementation, which follows the Unicode algorithm — so it is accurate for the web and for anything else that implements the standard. Terminals, PDF renderers and older editors vary, and a string that renders correctly here can still surprise you elsewhere.

Frequently asked questions

Why does punctuation move to the wrong side in mixed text?
Because brackets, slashes and full stops are neutral characters with no direction of their own — they take it from whatever surrounds them. Between an Arabic run and an English one the algorithm has to pick, and it often picks the side you did not want. Wrapping the embedded run in an isolate, U+2066 to U+2069, settles it.
What is trojan source?
A 2021 attack, CVE-2021-42574, that puts a direction override inside a comment or string so the file reads one way in an editor and compiles another — code that looks like a comment actually executes. Any strong override in source is worth treating as hostile, which is why this tool flags that combination specifically.
Are there any usage caps on the RTL and Bidi Text Checker?
There is no cost and no cap. The RTL and Bidi Text Checker is not a demo of a paid product, so nothing is held back or watermarked.
Does anything I enter leave my computer?
No. The RTL and Bidi Text Checker runs entirely in your browser using JavaScript. Nothing is transmitted, logged or stored, which you can verify yourself in the Network tab of your browser's developer tools.
What formula does the RTL and Bidi Text Checker use?
It uses embeddings and isolates are matched as a stack: every LRE, RLE, LRO and RLO needs a PDF, and every LRI, RLI and FSI needs a PDI. An unbalanced stack leaks direction into the text that follows. The full working is printed under the result, so you can follow every step rather than trusting a black box.
What is the RTL and Bidi Text Checker used for?
Typical uses: debugging Arabic or Urdu text that renders in the wrong order. Checking pasted source code for a trojan-source attack. Understanding why punctuation jumps sides in mixed text. It is built for exactly those cases rather than being a general-purpose tool with this bolted on.
Where does the RTL and Bidi Text Checker stop being reliable?
The preview uses your browser's own bidi implementation, which follows the Unicode algorithm — so it is accurate for the web and for anything else that implements the standard. Terminals, PDF renderers and older editors vary, and a string that renders correctly here can still surprise you elsewhere. Knowing where a tool stops being trustworthy matters more than the cases where it works.
What are the key numbers for the RTL and Bidi Text Checker?
Base direction is Set by the first strong character. Neutrals is Take direction from their neighbours. Isolates U+2066-2069 is Preferred over embeddings. These are printed on the page itself, so you do not have to take them on trust.
Is there an app version?
Yes. The page is responsive and the page works in Chrome, Safari, Firefox, Edge and Samsung Internet on both Android and iOS. There is no app to install and nothing to sign into.

Related lab tools

All 30
03

Mojibake Fixer

Repairs text mangled by the wrong character encoding — the "’" and "é" problem — by…

07

Sentence Rhythm Analyzer

Measures the variation in your sentence lengths — the thing that makes prose readable, which…

08

Recipe Scaler

Rescales every quantity in a recipe for a different number of servings, keeping fractions…

09

CSV Column Analyzer

Profiles every column of a CSV — type, blanks, distinct values, ranges — and flags the ragged…

10

Fuzzy Duplicate Finder

Finds lines that are nearly the same, not just identical — catching "Acme Ltd." against "Acme…