Overview
Introduction
Spotting every occurrence of a specific letter across a long passage is easy to get wrong by eye, especially with a common letter.
It runs entirely client-side, so nothing you paste is ever uploaded to a server.
What Is Letter Highlighter?
A letter highlighter that wraps every occurrence of a chosen letter, matched case-insensitively, with a marker string like '**' on both sides.
It runs entirely client-side as part of this site's String Tools collection, so nothing you paste is ever uploaded to a server.
How Letter Highlighter Works
Each character of the input is compared, lowercase to lowercase, against the target letter, and any match is wrapped in the marker string while the original character's case is preserved.
The transformation happens synchronously in JavaScript the moment you type, with no network round trip involved.
When To Use Letter Highlighter
Use it to teach phonics by highlighting a target letter, check letter frequency visually, or prepare a passage for a search-and-highlight demo.
It's a fast way to get the answer without opening a code editor, a REPL, or writing a one-off script just to check.
Often used alongside Word Highlighter and Multi-Pattern Highlighter.
Features
Advantages
- Preserves the original case of every highlighted letter.
- Works with any marker string, not just a fixed symbol.
- Iterates by Unicode code point rather than by UTF-16 unit, so emoji and astral characters elsewhere in the text stay intact instead of being split apart.
Limitations
- Highlights a single target letter per run; use the multi-pattern version for several terms at once.
- Matches a single character per run, so a digraph such as 'ch' or 'th' cannot be highlighted as one unit.
Examples
Best Practices & Notes
Best Practices
- Use a distinct marker like '[[' / ']]' if the text already contains asterisks, to avoid ambiguity.
- Pick a marker that does not already occur in the text, otherwise the result is ambiguous to read and impossible to parse reliably afterwards.
- Highlight one letter at a time and compare the runs when studying frequency, rather than trying to read several markers layered together.
Developer Notes
The implementation spreads the input into Unicode code points with `[...input]` and maps each one, comparing `char.toLowerCase() === target` before wrapping, which keeps multi-byte characters intact rather than iterating over UTF-16 code units.
Letter Highlighter Use Cases
- Teaching phonics or spelling by highlighting a target letter
- Visually checking letter frequency in a passage
- Preparing sample text for a search-and-highlight demo
Common Mistakes
- Expecting multiple different letters to be highlighted at once with this tool.
- Entering more than one character as the target letter.
Tips
- Use the Multi-Pattern Highlighter instead if you need to mark several different letters or words simultaneously.
- Each highlighted occurrence adds two markers, so dividing the marker count by two gives that letter's frequency without needing a separate counting tool.