Written by Allen Wyatt (last updated July 7, 2025)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Word in Microsoft 365
Aaron has a document that contains a number of HTML tags, and he would like to remove the tags but maintain the formatting they represent. For instance, if he has <i>a phrase</i> that appears this way, he would like to remove the tags (<i> and </i>) but have "a phrase" appear in italics. Aaron is pretty sure this can be done with Find and Replace, but he's not quite sure how to go about it.
You are right, Aaron—you can use Find and Replace to accomplish the removal. The way you would do it is to follow these steps:
Figure 1. The Replace tab of the Find and Replace dialog box.
The code that you enter in the Find What box (step 4) may look a little daunting. All you are telling Word to do is to find the beginning HTML tag (<i>) followed by any number of characters and ending with the closing HTML tag (</i>). The very short entry in the Replace With box (step 5) simply says to replace whatever is found with the contents of the first element of the Find What box that is surrounded by parentheses—which just happens to be the text between the two HTML tags.
If you want to eliminate the need to remember (or look up) the contents of the Find What box all the time, you can place the Find and Replace operation into a macro:
Sub ConvertItalicTags() Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting Selection.Find.Replacement.Font.Italic = True With Selection.Find .Text = "\<i\>([!<]@)\</i\>" .Replacement.Text = "\1" .Forward = True .Wrap = wdFindContinue .Format = True .MatchCase = False .MatchWholeWord = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchWildcards = True End With Selection.Find.Execute Replace:=wdReplaceAll End Sub
Assign the macro to a shortcut key, and you can remove the italic HTML tags anytime you need. You could also expand the macro to make similar changes relative to other HTML tags you may need to remove. You may even want to make sure that alternate tags are dealt with. For instance, HTML uses both <i> and <em> tags to display information in italic, which means you should account for the possibility of both sets of tags in your macro.
Of course, there is an entirely different approach you could use to get rid of the HTML tags and still retain the formatting associated with those tags. That would be to save the HTML-encoded text into a text file, open it in your browser, copy the text within the browser window, and paste it directly into a Word document. If all goes well, you would have the desired formatted text in your finished document.
Note:
WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (10308) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Word in Microsoft 365.
Do More in Less Time! An easy-to-understand guide to the more advanced features available in the Microsoft 365 version of Word. Enhance the quality of your documents and boost productivity in any field with this in-depth resource. Complete your Word-related tasks more efficiently as you unlock lesser-known tools and learn to quickly access the features you need. Check out Microsoft 365 Word For Professionals For Dummies today!
If you need to find words that mix uppercase and lowercase characters together, you will appreciate this tip. Here I show ...
Discover MoreWhen you receive documents created by others, it is not unusual that you'll want to edit what they've written. For ...
Discover MoreNeed to know how many times a particular word appears in a document or a portion of a document? Here's a handy trick that ...
Discover MoreFREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)
Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.
Visit the WordTips channel on YouTube
FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2025 Sharon Parq Associates, Inc.
Comments