Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
HTML

Why Internet Explorer Shows Your HTML Code as Text—and How to Fix It

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If Internet Explorer shows tags such as <html> and <p> instead of rendering a page, the file is usually not being treated as HTML. The most common cause in this workflow is copying HTML source into Word and exporting it again: the source becomes the document’s visible content. Edit the original source in a plain-text editor, save it directly with a real .html or .htm extension, and verify the server identifies hosted files as HTML.

What caused the tags to appear?

A common Word workflow is:

  1. Create or export a document as a web page.
  2. Open that page and view its source.
  3. Copy the source into a new Word document.
  4. Save the new document as HTML.

The last step does not preserve the source as executable markup. It creates an HTML document whose body contains the copied source characters. The browser therefore receives text to display, not tags to interpret. Word may also add namespaces, metadata and auxiliary files because it is a rich-document exporter rather than a source-code editor.

As Gary Turner explained in the relevant SitePoint discussion, after modifying Word’s source you should “simply save it” rather than paste it back into Word. In other words, modify the existing source file directly.

Fix a local file step by step

1. Edit the source outside Word

Open the original HTML file in Notepad or another plain-text editor. Do not paste the source into a new Word document and export it again. Save changes to that same text file.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
HTML and CSS: Design and Build Websites
  • HTML CSS Design and Build Web Sites
  • Comes with secure packaging
  • It can be a gift option

2. Confirm the real extension

Use .html or .htm. Windows can hide known extensions, so a file that appears to be home.html may actually be home.html.txt. Turn on file-name extensions in File Explorer and rename the file if necessary.

3. Start with a normal document structure

A minimal page should have a doctype, an html element, a head, and a body:

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Test page</title>
</head>
<body>
  <h1>It works</h1>
  <p>This text should be rendered, not shown as tags.</p>
</body>
</html>

Save the file as plain text, then open that directly saved file in Internet Explorer. If this minimal page renders, add your original sections back a piece at a time. The first addition that makes the page fail identifies malformed markup or a missing asset.

4. Keep presentation separate

Put CSS in a separate stylesheet when practical instead of relying on Word’s generated formatting. This makes the source easier to inspect and avoids carrying Word-specific markup into a hand-maintained page.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Check hosted pages separately

A file can be correct on disk and still be delivered incorrectly by a web server. For a hosted page, inspect the HTTP response metadata and confirm that the response is identified as HTML, normally with an HTML Content-Type. The W3C HTML specification says that the actual type supplied by the response is used to determine how a fetched resource is processed. If the server labels the file as plain text, a browser may display the markup rather than parse it as a document.

This creates two distinct troubleshooting cases:

Where you open the file What to verify Likely correction
Local file opened from your computer The file is plain text and its real name ends in .html or .htm Edit and save directly in a text editor; remove an accidental .txt suffix
Page fetched from a website The server’s response identifies the resource as HTML Correct the server or hosting MIME/Content-Type configuration
Source visibly contains escaped or literal tags The markup was copied into a document as content Restore the original source and stop the Word round trip

Do not make JavaScript a prerequisite

JavaScript is not the fix for HTML being displayed as text. First make the document, navigation and essential content work without scripting. Add JavaScript afterward to enhance the experience. A script-dependent page can appear broken even after the markup problem is corrected, especially in an old browser or when scripts are blocked.

Rank #4
Sale
Web Design with HTML, CSS, JavaScript and jQuery Set
  • Brand: Wiley
  • Set of 2 Volumes
  • A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

When Word is the wrong tool

Word can export a document for viewing on the web, but its generated markup is difficult to maintain and is not a good substitute for learning HTML and CSS. For a page you intend to edit repeatedly, use a plain-text code editor and standard markup. A beginner HTML/CSS book can help with document structure, selectors and validation, but the essential change is the editing workflow: source stays source, and the browser receives it directly.

Quick diagnostic checklist

  • Did you copy “View Source” output into Word before saving again?
  • Are you editing the existing HTML file in a plain-text editor?
  • Does the actual filename end in .html or .htm, rather than .txt?
  • Does the file begin with a doctype and contain separate head and body sections?
  • If it is hosted, does the HTTP response identify it as HTML rather than plain text?
  • Does a minimal page render before you restore the rest of the content?
  • Does the page’s basic content work before JavaScript is added?

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Read next

Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.