Skip to main content

Hidden Characters

Remove BiDi & Directional Control Characters

CleanPastedText editorial · Updated

Text workbench

Try it on your text

Cleaning mode

Removes hidden characters and standardizes AI-style punctuation.

Try a real example

Each sample contains a problem you cannot see.

Original

Pasted text

0 chars · 0 words

Cleaned

Ready to copy

0 changes

Text stays in this browser

Same words · No AI rewriting · No content logging

What are BiDi characters and why do they cause glitches?

Bidirectional (BiDi) characters are hidden markers like the left-to-right mark (U+200E) and right-to-left mark (U+200F). They are essential for handling mixed-direction text — for example, a paragraph containing both English and Arabic.

However, when these markers are copied "out of context" — such as copying a single English word from a multilingual site — they remain embedded in the text. This causes your cursor to jump to the wrong side of a word, makes highlighting text nearly impossible, and can even flip the displayed order of punctuation like periods and parentheses. Like all invisible characters, they have no glyph, so you can't find them by looking.

Why are BiDi characters dangerous in code?

BiDi markers are particularly dangerous for developers. If a directional override ends up inside a string or an identifier, the code can display one way while compiling another. This is the basis of the "Trojan Source" attack (CVE-2021-42574): override characters such as U+202E reorder what reviewers see on screen, so a line that looks like a harmless comment can actually contain executing logic. That's why many code editors and GitHub now warn about BiDi characters in diffs — and why pasted snippets should be sanitized before committing. To audit a snippet without altering it first, the hidden character checker lists every directional control it finds by code point and count, leaving the text as it is.

Our tool identifies every directional control character — U+200E, U+200F, the Arabic letter mark U+061C, the embedding and override set U+202A through U+202E, and the newer isolates U+2066 through U+2069 — and strips them completely, "resetting" the text to the default direction of your destination editor. See the full invisible Unicode characters list for every code point covered, or the zero-width space remover for the other big family of invisible troublemakers.

Common questions

Frequently asked questions

What are BiDi control characters?

They are invisible Unicode characters that control the direction text is displayed in: the left-to-right mark (U+200E), right-to-left mark (U+200F), the embedding and override controls (U+202A through U+202E), and the newer isolate controls (U+2066 through U+2069). They exist so mixed-direction text — English with Arabic or Hebrew — renders correctly, but copied out of context they wreak havoc.

How do I remove BiDi characters from text?

Paste the text into a cleaner that targets the directional ranges, like CleanPastedText. It matches U+200E, U+200F, U+061C, U+202A–U+202E, and U+2066–U+2069, deletes every occurrence, and reports the count under 'Directional markers removed'. This resets the text to follow the natural direction of its characters and your editor's default.

Why does my cursor jump around when I select or edit text?

A stray directional mark is usually the cause. When a hidden right-to-left mark sits inside left-to-right text, the editor renders part of the line in the opposite direction: the cursor appears to jump to the wrong side, highlighting selects unexpected ranges, and punctuation like periods or parentheses displays in the wrong place. Removing the mark fixes all of it.

What is a Trojan Source attack?

A technique (CVE-2021-42574, published in 2021) that uses BiDi override characters to make source code display differently than it compiles. A reviewer sees an innocent-looking line while the compiler executes reordered logic — for example, code that appears to be inside a comment but actually runs. Stripping directional controls from pasted code snippets neutralizes the attack.

Will removing BiDi marks break my Arabic or Hebrew text?

Generally no. Arabic and Hebrew letters carry inherent right-to-left directionality, so normal text renders correctly without any control characters — the Unicode BiDi algorithm handles it automatically. Explicit marks are only needed for edge cases like neutral punctuation at direction boundaries. The 'What changed' report shows exactly how many marks were removed so you can verify the result.

Continue reading

Related guides & tools