User Rating 0.0 โ˜…โ˜…โ˜…โ˜…โ˜…
Total Usage 0 times
Paste or type any LTR text. Max 100,000 characters.
Is this tool helpful?

Your feedback helps us improve.

โ˜… โ˜… โ˜… โ˜… โ˜…

About

Text directionality errors cause layout corruption in multilingual interfaces. When left-to-right (LTR) strings are injected into right-to-left (RTL) contexts without proper Unicode Bidirectional Algorithm markers, punctuation migrates, numbers detach from their labels, and paired delimiters like ( and ) appear inverted. This converter applies UAX #9 embedding controls - U+200F (RLM), U+202B (RLE), and U+2067 (RLI) - to reorder text for RTL paragraph contexts. It also mirrors bracket pairs per the Unicode BidiMirroring.txt specification. The tool does not transliterate; it restructures directionality metadata.

Incorrect bidi handling is a common source of bugs in web applications serving Arabic, Hebrew, Persian, or Urdu content. Misplaced parentheses in legal documents or financial statements can alter meaning. This tool approximates correct visual output assuming a base RTL paragraph direction. Pro Tip: always test converted output in the actual rendering engine (browser, PDF viewer) since bidi resolution depends on the embedding context and font support.

rtl converter right to left text bidi text unicode rtl text direction converter arabic text direction hebrew text tool rtl embedding

Formulas

The Unicode Bidirectional Algorithm (UAX #9) determines display order through embedding levels. Each character carries an intrinsic bidi class (bc). Strong classes (L, R, AL) anchor direction. Weak classes (EN, AN, ES) inherit from context. Neutral classes (ON, WS) resolve based on surrounding strong types.

EmbeddingLevel(char) = base_level + depth ร— 1

where base_level = 0 for LTR paragraphs and 1 for RTL paragraphs. Even embedding levels render LTR; odd levels render RTL.

Visual Order Rule: if level is odd โ†’ reverse character sequence within that level run

Bracket mirroring applies the mapping function:

Mirror(c) = BidiMirroring[c] if c โˆˆ MirroredSet, else c

where BidiMirroring is the Unicode consortium's canonical mirror pair table. This converter implements four modes: REVERSE (simple character reversal per line), RLM (prepend U+200F to each line), RLE (wrap with U+202Bโ€ฆU+202C), and RLI (wrap with U+2067โ€ฆU+2069, the modern recommended approach). Bracket mirroring is applied in REVERSE mode only, since marker-based modes let the rendering engine handle mirroring.

Reference Data

Unicode Code PointNameAbbreviationBidi CategoryEffect
U+200FRight-to-Left MarkRLMRInvisible strong RTL character; forces adjacent neutrals to resolve as RTL
U+200ELeft-to-Right MarkLRMLInvisible strong LTR character; forces adjacent neutrals to resolve as LTR
U+202BRight-to-Left EmbeddingRLEEmbeddingOpens an RTL embedding level; deprecated in favor of isolates
U+202ALeft-to-Right EmbeddingLREEmbeddingOpens an LTR embedding level
U+202CPop Directional FormattingPDFTerminatorCloses the most recent RLE, LRE, RLO, or LRO
U+2067Right-to-Left IsolateRLIIsolateOpens an RTL isolate scope; recommended over RLE
U+2066Left-to-Right IsolateLRIIsolateOpens an LTR isolate scope
U+2069Pop Directional IsolatePDITerminatorCloses the most recent RLI, LRI, or FSI
U+202DLeft-to-Right OverrideLROOverrideForces all characters to display LTR regardless of bidi class
U+202ERight-to-Left OverrideRLOOverrideForces all characters to display RTL regardless of bidi class
U+061CArabic Letter MarkALMALStrong Arabic-type character; resolves neutrals in Arabic context
U+2068First Strong IsolateFSIIsolateAuto-detects direction from first strong character in scope
U+0028 โ†” U+0029Parentheses Mirror( โ†” )ON (Other Neutral)Mirrored in RTL context per BidiMirroring.txt
U+005B โ†” U+005DSquare Bracket Mirror[ โ†” ]ONMirrored in RTL context
U+007B โ†” U+007DCurly Brace Mirror{ โ†” }ONMirrored in RTL context
U+003C โ†” U+003EAngle Bracket Mirror< โ†” >ONMirrored in RTL context
U+00AB โ†” U+00BBGuillemet Mirrorยซ โ†” ยปONMirrored in RTL context
U+2018 โ†” U+2019Single Quote Mirror' โ†” 'ONMirrored in RTL context
U+201C โ†” U+201DDouble Quote Mirror" โ†” "ONMirrored in RTL context

Frequently Asked Questions

RLE (Right-to-Left Embedding, U+202B) sets an embedding level that can interact with surrounding text and potentially cause spillover effects. RLI (Right-to-Left Isolate, U+2067) creates an isolated directional scope that does not affect adjacent characters. The Unicode Consortium recommends RLI over RLE for all new content since Unicode 6.3. Use RLE only when targeting legacy systems that do not support isolate controls.
Parentheses, brackets, and other paired delimiters have the bidi_mirrored property set to Yes in the Unicode Character Database. In an RTL resolved context, the rendering engine should automatically mirror them. However, when text is naively reversed (character-by-character), the opening parenthesis U+0028 physically moves to the right side without being replaced by U+0029. This converter's Reverse + Mirror mode applies the BidiMirroring substitution table to swap all 18 standard mirror pairs, preventing this visual corruption.
The marker-based modes (RLM, RLE, RLI) set the paragraph base direction to RTL and rely on the rendering engine's bidi algorithm to correctly position embedded LTR runs (Latin characters, European numbers). The simple Reverse mode does not distinguish script types and will reverse everything, which corrupts mixed-script text. For mixed content, always use RLI mode.
In marker-based modes, European numbers (bidi class EN) retain their left-to-right internal order because the Unicode bidi algorithm treats digit sequences as weak LTR runs. In simple Reverse mode, multi-digit numbers will appear digit-reversed (e.g., 2024 becomes 4202). The Reverse mode in this tool preserves number sequences by detecting contiguous digit runs and excluding them from reversal.
Bidi markers are zero-width invisible characters. They persist in the string and can affect string length calculations, regex matching, database storage, and search indexing. When copying converted text into code or data fields, be aware that string.length will include these markers. Some systems strip them; others do not. The tool displays the exact Unicode code points inserted so you can audit the output.
CSS dir=rtl and direction:rtl set the paragraph base direction at the rendering level, which is generally preferred for HTML content. Unicode markers are necessary when you cannot control the rendering context - for example, in plain text files, SMS messages, email subjects, filenames, or database fields that will be displayed in unknown contexts. Use CSS for web; use Unicode markers for plain text transport.