Join our Newsletter — 33% off our NHI Course
Home› Guides› Lookalike Letters and Invisible Characters for Beginners: How…
Guide Application Security

Lookalike Letters and Invisible Characters for Beginners: How Hidden Text Tricks People and AI

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 30 November 2026 10 min read
On this page

Lookalike letters and invisible characters are text tricks that make words look safe while computers read something else.

This guide is for anyone who reads links, reviews code or uses AI tools and wants to understand hidden text. You do not need to know how computers store letters. It covers lookalike names, hidden characters in code and hidden instructions aimed at AI.

In short

  • Many alphabets have letters that look the same. A Cyrillic "а" and a Latin "a" look identical but are different characters to a computer.
  • Some characters are invisible, or change the order text is shown in, so what you see is not what the computer reads.
  • Attackers use these tricks in web addresses, in code and in text that AI tools read.
  • The fix is to let software show or flag unusual characters, instead of trusting your eyes.

What you will learn

  • Explain what a homoglyph is and why it fools people.
  • Describe how invisible and direction-changing characters can hide what code does.
  • Recognise how hidden text can steer an AI tool.
  • Name simple checks that catch these tricks.
Lookalike letter (homoglyph)
a character that looks like another one but is stored as a different character.
Hidden character (invisible character)
a character that takes up no visible space on screen but is still there.
Shared alphabet list (Unicode)
the worldwide standard that gives every letter and symbol its own number.

What are lookalike letters and invisible characters?

Imagine two keys cut to look exactly alike. One opens your front door. The other opens a stranger's shed. You cannot tell them apart by looking, only by trying them.

Computers store each letter as a number from a shared list called Unicode. Latin, Cyrillic and Greek each have their own letters, and several of them look almost the same. The browser makers at Chromium give the example "аррӏе.com", spelt entirely with Cyrillic letters that look like Latin ones [2].

Other characters cannot be seen at all, or they change the order in which text is shown on screen. Researchers at the University of Cambridge showed that these can make code look different from what a computer actually runs [1].

Where the comparison stops working: you can try a key in a lock. With text, the "lock" is a computer, and it always reads the real characters, never what you think you saw.

This page sticks to the tricks themselves. The practitioner detail is in Unicode Security.

Why does it matter?

Most of us check names and text by eye. These tricks are designed to beat exactly that check.

If you click links and open emails

What could happen: a web address looks like your bank's, but one letter comes from another alphabet.

Check this: type important addresses yourself or use a saved bookmark.

Next: Phishing for Beginners

If you write or review code

What could happen: a change looks harmless in review, but hidden characters make the computer run it differently.

Check this: make sure your editor and code host warn about hidden and mixed-alphabet characters.

Next: Secure Code Review for Beginners

If you use AI tools at work

What could happen: a document or web page carries instructions you cannot see, and an AI tool follows them.

Check this: limit what an AI tool can do on its own after reading outside content.

Next: Prompt Injection for Beginners

What does it look like?

Here is a made-up review note comparing what a person sees with what a checking tool reports.

Example only. All values are made up.

What you see:        paypa1-example.invalid             (1)
What the tool shows: xn--EXAMPLE-fake.invalid           (2)

What you see:        function sayHello()                (3)
What the tool shows: function say[CYRILLIC H]ello()     (4)

What you see:        "Summarise this page."             (5)
What the tool shows: "Summarise this page.[HIDDEN TEXT: 212 characters]"
  1. A web address that looks normal at a glance.
  2. Browsers can show such names in an encoded "xn--" form called punycode. In a real file, this line would contain the encoded name that reveals the foreign letters.
  3. A function name that looks familiar.
  4. In a real file, this line would contain the true character code, showing that one letter comes from another alphabet.
  5. Text that looks short, but carries hidden characters a person cannot see and an AI tool may still read.

Why this is risky: every line passes a check by eye. Only software that looks at the actual characters spots the difference.

The safer way: use tools that reveal hidden characters and flag mixed alphabets, and treat any warning as worth a second look.

How does it work?

  1. Every character has its own number. Two letters can look identical on screen and still have different numbers underneath.
  2. Lookalikes fool the eye. Swapping one Latin letter for a Cyrillic twin makes a new name that looks the same. The Cambridge researchers show this with two functions, sayHello and a copy using a Cyrillic "Н", that look the same but are different [1].
  3. Direction characters reorder the display. Some languages are written right to left. Special control characters handle this, and they can make code appear in a different order from the order a computer reads [1].
  4. Invisible characters hide content. They take no visible space, so extra text can sit inside a message unseen. OWASP notes that prompt injection can work even when the text is not visible to humans, as long as the model reads it [3].
  5. Software can reveal the trick. Browsers, editors and checking tools can show the true characters or warn about them.
Diagram titled What you see is not what the computer reads. Three boxes in a row. Box one, Lookalike letters: a Cyrillic a looks like a Latin a, so a fake name looks real. Box two, Direction characters: control characters change the order text is shown in, so code looks different from what runs. Box three, Invisible characters: they take no space on screen, so hidden words can reach an AI tool. Arrow to a final highlighted box, The fix: let software show the real characters and flag mixed alphabets. A note underneath says your eyes cannot catch these tricks, so tools must.
Figure 1. Three kinds of hidden text trick, and the common fix.

In 2021 this research led to two public vulnerability records, one for each trick [1]. The researchers advise that compilers, editors and code hosts should warn about these characters [1].

Browsers defend web addresses in a similar way. Chrome shows a name in its encoded "xn--" form if it mixes Latin, Cyrillic and Greek. It does the same for invisible characters, or a name too like a well-known domain [2].

A worked example

This story is made up to show the idea.

Otto Vance maintains a small open source library at a firm called Larkspur Tools. A new contributor sends a change that adds a helper called checkLicence. It looks tidy and passes the tests.

Otto's code host shows a yellow warning beside one line. It says the line has characters that may be confused. He nearly ignores it, because the code looks fine.

His colleague Soren Kowal suggests opening the file in a viewer that shows hidden characters. One letter in checkLicence turns out to be Cyrillic. The project already has a real checkLicence function, so the change quietly adds a second one with a lookalike name.

Other code in the change calls the fake function, which always says the licence is valid. A reviewer reading by eye would never have seen it. Soren points out that the tests passed because nobody had written a test for an invalid licence.

Otto rejects the change and turns on a check that fails any build containing mixed-alphabet names or hidden direction characters. He also adds a note to the project's review guide.

Otto learned that the warning, not his eyes, was the reliable signal. He now treats every "confusable character" warning as worth checking.

Myths and mistakes

What people thinkWhat is true
If it looks right, it is right.Lookalike letters are designed to look right. Only the stored characters tell the truth.
This only affects web addresses.It also affects code, file names, usernames and text that AI tools read[1][3].
Code review will always catch hidden changes.Direction characters can make code display differently from how it runs, so reviewers can be fooled[1].
AI tools only read the text I can see.A model can read characters a person cannot see[3].
The fix is to ban all non-English letters.People need many alphabets. The better fix is to flag risky mixes and hidden characters, as browsers do[2].

What can I do this week?

  • Save bookmarks for your bank, email and work tools, and use them instead of links.
  • Check that your code editor can show hidden characters, and turn it on.
  • Ask whether your code host warns about confusable characters in changes.
  • Read Prompt Injection for Beginners to see how hidden text can steer AI tools.

Checklist

  • I know two letters can look the same and still be different.
  • I know some characters are invisible but still read by computers.
  • I use bookmarks or type addresses for important sites.
  • Our editors and code hosts show warnings about hidden characters.
  • Our builds fail on mixed-alphabet names or hidden direction characters.
  • AI tools that read outside content cannot act on it without limits.
  • I treat "confusable character" warnings as worth checking.

Common questions

What is a homoglyph attack?

It is a trick that swaps a letter for a lookalike from another alphabet. The result looks like a trusted name, such as a website or function, but the computer treats it as something different. It is used in fake web addresses and in code.

What is punycode and why do I sometimes see xn-- in an address?

Punycode is a way of writing international web addresses using only basic letters. Browsers such as Chrome show the xn-- form when a name looks risky, for example when it mixes alphabets or imitates a well-known site. Seeing it is a sign to slow down.

What was Trojan Source?

It was research from the University of Cambridge showing that hidden direction characters and lookalike letters can make source code look different from what runs. It led to two CVE records in 2021.

Can invisible characters affect AI chatbots?

Yes. OWASP notes that prompt injection does not need to be visible to people, only readable by the model. Hidden text in a page or file could carry instructions. Treat outside content as untrusted and limit what AI tools can do with it.

How do I check text for hidden characters?

Many code editors have a setting that shows invisible characters as small symbols. Checking tools can also list the code behind each character in a piece of text. For everyday browsing, rely on bookmarks and your browser's built-in protection.

Where next?

Ready for the detail? Read the practitioner guide: Unicode Security. It covers confusable detection, normalisation and build controls in depth.

Also useful:

Related NHI Mgmt Group resources: Phishing for Beginners, Software Supply Chain Security for Beginners and Choosing Open Source Packages for Beginners.

Key terms

Homoglyph attack
An attack that swaps letters for lookalikes from another alphabet so a fake name looks real.
Invisible Unicode characters
Characters that do not show on screen but still change how software reads the text.
Unicode
The worldwide standard that gives each letter and symbol, in every writing system, its own number.
Punycode
A way of writing international domain names using only basic letters, digits and hyphens, starting with xn--.
Unicode normalisation
Converting text into one consistent form so that different ways of writing the same thing compare as equal.
Indirect prompt injection
Hiding instructions in content an AI tool reads later, such as a web page or document.

Sources and further reading

  1. Nicholas Boucher and Ross Anderson, University of Cambridge, "Trojan Source: Invisible Vulnerabilities". https://trojansource.codes/ (accessed 30 Nov 2026).
  2. The Chromium Projects, "Internationalized Domain Names (IDN) in Google Chrome". https://chromium.googlesource.com/chromium/src/+/main/docs/idn.md (accessed 30 Nov 2026).
  3. OWASP, "LLM01:2025 Prompt Injection", OWASP Top 10 for LLM Applications 2025. https://genai.owasp.org/llmrisk/llm01-prompt-injection/ (accessed 30 Nov 2026).

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.