Notepad++

How to Highlight Text in Notepad++

How to Highlight Text in Notepad++

Select the word, right-click, choose Style all occurrences of token, and pick a numbered style. That is the quickest way to color text in Notepad++. Search matches go through the Mark tab and whole lines go through bookmarks, while Smart Highlighting runs by itself whenever you select something.

Only Style Token gives you several colors, since the Mark tab paints every match with a single style. Nothing here gets saved in the file, so closing the document clears the color (Notepad++ Community forum).

Permanent coloring needs a User Defined Language, which assigns colors to keyword groups that apply every time the file opens.

How to highlight a word or selection with Style Token

YouTube player

Notepad++ colors every match in the open document at once, using one of five numbered styles.

  1. Double-click the word or select the exact text. With nothing selected, the word under the caret counts as the token (Notepad++ User Manual).
  2. Right-click and open Style all occurrences of token. The same submenu sits under Search > Style All Occurrences of Token.
  3. Pick Using 1st Style through Using 5th Style. Each number has its own color.
  4. To color one spot only, use Style one token instead.
  5. To undo it, pick Remove style in the right-click menu or go to Search > Clear Style.

The naming trips people up. This submenu used to be called Mark All, and the Mark tab in the Find dialog still has a button with that exact label.

Style Token starts from a selection. The Mark tab starts from a search, and that comes next.

Case and word boundaries come from Settings > Preferences > Highlighting, in the Style All Occurrences of Token group. With Match whole word only off, styling “it” also colors the letters inside “hitch”.

Upgrading can leave the right-click menu a little short. If you started on a version older than v8.0, the installer keeps your old contextMenu.xml in %AppData%\Notepad++, so the newer Style one token entry never shows up (Notepad++ Community forum, 2021). Delete the file and Notepad++ rebuilds it from defaults, which also wipes any custom right-click entries.

Highlight several words in different colors

YouTube player

Give each word its own style number and repeat the select, right-click, pick-a-style routine once per word.

Five styles means five colors, so a sixth word has to share one or stack styles. Applying two or more styles to the same text blends their colors, which gives up to 31 combinations, though they get hard to tell apart (Notepad++ Community forum).

The Search menu submenus include Jump Up and Jump Down, which move you to the next or previous stretch of text in a chosen style. That beats scrolling a long log. Copy Styled Text sends everything carrying a chosen style to the clipboard.

One forum thread asked for dozens of repeated words, each in its own color. The reply was blunt: Notepad++ has no such range, and token styles are meant as temporary markers.

For more than five at once, a regular on the same forum points to the Analyse plugin, which applies several regular expressions to the same file. By his recollection it colors hits in the plugin’s own results window, not inline.

Assign keyboard shortcuts to the five styles

The token commands ship without default shortcuts, according to the Notepad++ Community forum.

Open Settings > Shortcut Mapper, type style into the Filter box, select the entry for the style you want, and click Modify.

New to Notepad++ or just need a quick reference? Essential shortcuts, regex for Find & Replace, and advanced editing - including Ctrl+H, Column Mode, and Macro Recorder - is on one page in the Notepad++ Cheat Sheet.

The Mark tab is different. Ctrl+M opens it by default, and the manual notes that every default can be changed in the same mapper.

How to highlight all matches with the Mark tab

YouTube player

Press Ctrl+M, type the text in Find what, and click Mark All. Every match in the current document gets the Mark highlight.

The tab also opens from Search > Mark. It needs no selection, so it suits words you have not located yet.

One catch up front. The Mark tab paints every match with a single style, the Find Mark Style under Settings > Style Configurator > Global Styles. Alan Kilborn, a long-time forum contributor, puts it flatly: Ctrl+M searching uses only the default red styling.

OptionEffect on Mark AllWatch for
Match caseMarks exact capitalization onlyA (?i) regex flag overrides the checkbox
Match whole word onlySkips hits inside longer wordsUnchecks itself and greys out in regular expression mode
Wrap aroundMarks the whole file, start to endOff means caret to end of file only (or start to caret with Backward direction on)
In selectionMarks inside the selected text onlyFind Next still searches the whole document

Clear all marks strips the marking color. Tick Purge for each search and old marks disappear before every new Mark All, so results stop piling up.

Copy Marked Text puts the marked matches on the clipboard. It copies the matched text, not the lines around it (a forum poster’s observation on the Mark panel), so use bookmarks when you need whole lines.

Highlight with regular expressions

Switch Search Mode to Regular expression and one Mark All highlights a whole family of matches.

  • ERROR|WARN|FATAL marks three severity words in a single pass
  • \[[^\]\r\n]*\] marks bracketed text that stays on one line

Wrap a pattern in \b on both sides when you need whole-word behavior.

Notepad++ uses the Boost regex library, which the manual lists at v1.90 as of Notepad++ v8.9.1. Boost descends from PCRE syntax but is not PCRE, so a pattern tested on a PCRE-only site can behave differently here.

A malformed pattern fails quietly. The red “Invalid regular expression” message appears only after Find Next, while Mark All just reports nothing found. Run Find Next first.

Mark inside a selection or across open documents

Mark All works on the current document or on a selection, never on several tabs at once.

For other tabs, click Find All in All Opened Documents. Hits go to the Search results window (F7) with the match emphasized, red text on yellow by default, and you restyle it under the Search result language in the Style Configurator.

Those hits sit in the results list, not as color inside each tab.

Highlighting whole lines with bookmarks

YouTube player

Tick Bookmark line in the Mark tab before clicking Mark All, and every line with a hit gets a bookmark circle in the margin. That is the method for log files, where you want lines, not words.

A mark colors the matched text using the Find Mark Style, and Clear all marks removes it. A bookmark flags the whole line instead. It shows as a margin circle when Display bookmark is on under Preferences > Margins/Border/Edge, and it gets cleared from the Search > Bookmark menu.

The manual describes the two outcomes as separate: bookmarks when Bookmark line is ticked, colored matches otherwise. Run a quick test on a small file to see exactly what your version paints.

Clear all marks removes bookmarks too, but only while Bookmark line is still ticked at that moment.

Move between bookmarked lines and act on them

Next Bookmark and Previous Bookmark jump from hit to hit, and the shortcuts show beside each entry in Search > Bookmark.

Copy Bookmarked Lines copies whole lines, which Copy Marked Text does not. Remove Non-Bookmarked Lines leaves only the matching lines in the file. Inverse Bookmark flips every line, so unmatched lines become the bookmarked ones.

Cut, Paste to (Replace), Remove Bookmarked Lines and Clear all Bookmarks sit in the same menu, and a right-click on the bookmark margin offers them too.

Work on a copy before removing lines. Deletion is the point of those commands, and undo is your only safety net.

Limits are real here. A Community reply on v8.0 (June 2021) says bookmarks cannot take different colors and lines cannot be hidden by search result, and the current manual’s Bookmark menu lists neither option.

What is Smart Highlighting and how do you turn it off?

YouTube player

Select a word and every matching piece of text gets colored on its own, no menu needed. To switch it off, go to Settings > Preferences > Highlighting and clear Enable in the Smart Highlighting group.

That group has a few options worth knowing. Highlight another view extends the coloring to the second pane when documents sit in both. Match case makes matching case-sensitive, and Match whole word only requires a complete word, as defined by the Delimiter preferences. Use Find dialog settings makes it follow the Find dialog’s options instead.

The color comes from Settings > Style Configurator > Global Styles > Smart Highlighting.

Smart Highlighting disappears as soon as the selection moves. Apply a Style Token and the coloring stays, as one Community contributor explains it.

“Word” follows Settings > Preferences > Delimiter: letters, digits and underscore by default. Add the hyphen under Add your character as part of word and foo-bar counts as one word.

When it quietly stops working, two causes came up in a v8.4.4 thread where a 649 MB log refused to highlight while a smaller one worked. Highlight another view was off for the second pane, and large-file handling had switched Smart Highlighting off.

The manual’s Performance preferences now carry an Allow Smart Highlighting checkbox under Large File Restriction. Check there first.

How to change highlight colors in Notepad++

Open Settings > Style Configurator, pick Global Styles in the Language list, and edit the entry that matches the method. Click the background color box, then Save & Close.

Mark style 1 to 5 are the numbered Style Token slots. Find Mark Style covers everything the Mark tab marks, Smart Highlighting covers the automatic highlight, and Current line background colour controls the line holding the caret.

All four are background-only styles, so the foreground picker does nothing for them (Notepad++ User Manual).

Smart Highlighting and Find Mark Style are drawn at about 60% transparency, so the color on screen is paler than the swatch. The manual’s own example: pure green (0,255,0) over a white background shows up as roughly (155,255,155).

Smart Highlighting also paints over Selected text colour. If the two sit close together, the match stops standing out.

For the current line, set Settings > Preferences > Editing 1 > Current Line Indicator to Highlight Background. Choose Frame for an outline instead, with a Width slider for the line thickness.

Colors belong to the active theme. Switch theme, or turn on Dark Mode, and the highlight colors change with it.

Notepad++ writes its configuration files on exit, so a color edit reaches the theme file only then. Editing the XML by hand while also using the Style Configurator makes the two sets of changes collide, per the manual’s Themes page.

To reset the default theme, exit Notepad++, delete %AppData%\Notepad++\stylers.xml and restart. The file regenerates from stylers.model.xml, and your color edits are gone.

Which highlighting method fits which job?

Style Token suits a single word, the Mark tab suits patterns, and Bookmark line suits whole lines. Smart Highlighting is for a passive look at repeats. Each one has its own clear command.

MethodBest forColorsClear with
Style TokenA word you keep trackingNumbered stylesClear Style
Mark tabPattern or regex matchesSingle style (Find Mark Style)Clear all marks
Bookmark lineLines to review or extractNone, margin circleClear all Bookmarks
Smart HighlightingSpotting repeats while readingSingle style (Smart Highlighting)Move the selection, or untick Enable
  • Tracing one variable through code works best with Style Token and one style per variable
  • For every line with ERROR or a timestamp pattern, use the Mark tab with Bookmark line
  • A document full of repeated terms is fine with Smart Highlighting left on
  • To pull matches into another file, bookmarks win, because Copy Bookmarked Lines keeps the whole line

Smart Highlighting beats Style Token for casual reading. A token style earns its place only when the coloring has to outlive the selection.

The obvious choice is Style Token, and it is the wrong one for line work. It colors words, not lines.

None of these methods survives closing the file. The next section covers what does.

Why does highlighting disappear when you close a file?

Highlights are display styling on the open document, not characters in the file, so closing the file discards them. Only syntax highlighting and User Defined Language rules get applied again every time you open a file.

Sources differ on one word. The manual describes Mark tab highlighting as permanent, while Notepad++ Community answers say it does not persist after the document closes.

Read together, marks stay until you clear them, but they are never written into the file. A .txt holds characters only, and Notepad++ is a text editor, not a word processor.

Make coloring permanent with syntax highlighting and a User Defined Language

YouTube player

Built-in languages come from the Language menu, with colors set per language in the Style Configurator. For words you color the same way every time, a User Defined Language (UDL) does the job.

  1. Open Language > Define Your Language.
  2. Click Create new and name the language. The unnamed default is never saved, so changes to it vanish on exit (Notepad++ User Manual).
  3. Type the file extensions into the Ext. box, for example log.
  4. On the Keywords List tab, put your words in a group, separated by spaces, and click Styler to set the color.
  5. Close the dialog. Changes apply immediately and save automatically on exit.

The Keywords List tab offers eight groups, each with its own style. A group can also run in Prefix Mode, where the keyword for matches forth and format as well.

UDL colors mostly ignore the active theme. Switch to Dark Mode and a UDL can turn unreadable until you recolor it.

Foreground-only coloring by regex comes from the EnhanceAnyLexer plugin. You write color and regex pairs in its .ini file, and a pair such as ^.*ERROR.*$ colors every error line in the Normal text language (Notepad++ Community forum).

The plugin cannot change background color, bold, italic or font. Its author notes it processes only visible lines, so patterns that match text outside that range need care.

Hard limits of built-in highlighting

A few documented ceilings explain most of the failed attempts.

The longest Find what entry is 16383 bytes, counted in bytes, so accented and emoji characters eat the budget faster (Notepad++ User Manual).

In selection ticks itself once the selection passes 1024 characters by default, so Mark All stays inside the selection. You can lower the threshold under Settings > Preferences > Searching, but not raise it, and 0 turns the automatic ticking off.

Several UDL fields, such as operators, delimiters and comments, top out at Unicode codepoint 255.

When nothing colors at all, Large File Restriction is the first suspect. Once a file crosses its size threshold, syntax highlighting switches off for that file. A theme with no settings for the chosen language gives you no lexer colors either, and sometimes the active lexer just is not the one you think. The status bar and the Language menu show which one is running.

A color edit that changes nothing on screen usually means the wrong lexer is selected, not a broken theme.

Highlighting in Notepad++ FAQ

How do you highlight repeated words without knowing them in advance?

Use the Mark tab in regular expression mode with \b(\w+)\b(?=.*\b\1\b). With “. matches newline” unticked, it marks every word that appears again later on the same line, so no word list is needed.

Tick Bookmark line to flag those lines as well.

Does Incremental Search highlight every match?

Yes, once Highlight all is ticked. Open Search > Incremental Search (Ctrl+Alt+I) and every match is colored as you type. Without the tick, only the current match is.

The color comes from the Incremental highlight all style under Global Styles.

Which setting turns on matching tag highlighting?

YouTube player

Highlight Matching Tags under Settings > Preferences > Highlighting. Tick Enable in that group. It applies to HTML and XML files and colors both the opening and the closing tag.

Braces, brackets and parentheses are paired separately. Put the caret on one and both ends light up in the Brace highlight style.

Can a macro or script apply highlights?

Partly. A macro can record the Search menu’s Copy Marked Text, but not the dialog button’s version (Notepad++ User Manual).

To choose a style per search, use the PythonScript plugin. One forum demo prompts for a search string and a style number, then styles every hit.

Setting Up Highlighting in Notepad++ Once

A single setup pass turns a token style into one keystroke instead of a menu trip. Shortcuts come first because they remove the most clicks per session. Colors come next, since a pale style defeats a fast shortcut, and the Smart Highlighting matching rules go last because they only change how much text gets painted.

One trade-off applies. An Alt plus letter shortcut overrides that letter’s menu accelerator, according to the Notepad++ User Manual, so Ctrl combinations cost less.

Verified against the manual’s v8.9.9 edition on November 4, 2026. If a later release ships default shortcuts for the token styles, the first step drops out.

Bogdan Sandu

Stay sharp. Ship better code.

Every week: one curated article, one tool worth knowing, one tip you can use tomorrow. No noise, no padding.