Home » Blog » Digital Forensics » How to Convert HTML to TXT: Export Files in Bulk

How to Convert HTML to TXT: Export Files in Bulk

author
Written By
Nick Rogers
Published On
December 3rd, 2026
Reading Time
10 Minutes Reading
Quick answer: To convert HTML to TXT, copy a single page from your browser into Notepad. For a whole folder, run a Microsoft Word script, a LibreOffice command or a batch converter. Save the text as UTF-8 so non-English letters stay readable.

A TXT file holds characters and line breaks, nothing else. When a web page becomes plain text, your colours, fonts and pictures drop away, which is handy if you only want the words for notes, search or an import. However, each converter decides differently what counts as a word. One keeps text you never saw on screen, while another loses letters from other languages. Four routes were run on sample pages with Microsoft Word (build 16.0.20625), LibreOffice 25.8.4.2, headless Microsoft Edge and Windows PowerShell 5.1, so the table below shows you real differences. The desktop converter is described from its own screens and wasn’t run for this guide. Would one combined document suit you better? Then merge HTML files into text instead.

What 4 Methods Keep When HTML Becomes TXT

Read across a row to see what you’d get from each route. The browser column comes from the rendered text that headless Edge reported, so check your own paste too.

In the Web Page Word Script LibreOffice Command Browser Text Tag Stripper
Hindi letters, charset declared Kept Kept Kept Kept
Hindi letters, no charset line Garbled Kept Kept Kept
Block hidden by a style sheet Included Included Left out Included
Line written by a script Left out Left out Included Shows as code
Page title Left out Left out Left out Included
Link addresses and picture descriptions Dropped Dropped Dropped Dropped
Codes like & Turned into symbols Turned into symbols Turned into symbols Left as codes
Table cells One per line Split by tabs Split by tabs Run together
List items Marked and numbered Marked and numbered Own lines, no marks Run together

How to Convert HTML to TXT From Your Browser

For one or two pages, your browser and Notepad are enough. You also see the words before you copy them.

  1. Double-click the saved .html page so it opens in your browser.
  2. Press Ctrl+A to select the page, then Ctrl+C to copy.
  3. Open Notepad and paste with Ctrl+V.
  4. Choose Save As, set the encoding to UTF-8 and give the name a .txt ending.

Limitations: you handle one page at a time, and menus or footers usually come along with your selection.

Convert HTML to TXT With Microsoft Word

If Word is already on your PC, open the page there and go to File >> Save As. Set the type to Plain Text and select Save. In the File Conversion box, choose Other encoding and then Unicode (UTF-8). Microsoft explains this box in Choose text encoding when you open and save files.

For a folder, put copies of your pages in C:\HtmlToText and paste this script into PowerShell. Each TXT file is saved beside its page under the same name.

$folder = "C:\HtmlToText"
$word = New-Object -ComObject Word.Application
$word.DisplayAlerts = 0
foreach ($file in Get-ChildItem "$folder\*" -Include *.htm, *.html) {
    $doc = $word.Documents.Open($file.FullName, $false, $true)
    $out = [System.IO.Path]::ChangeExtension($file.FullName, ".txt")
    $doc.SaveAs2($out, 2, $false, "", $false, "", $false, $false, $false, $false, $false, 65001, $false, $false)
    $doc.Close($false)
}
$word.Quit()

The number 65001 asks for UTF-8. The two final $false values turn off added line breaks and symbol swaps, as named in Microsoft’s SaveAs2 reference. Note: when a test run left those two values out, the copyright sign came through as (c).

Limitations: Word has to be installed. Its output also carried hidden text, and a sample page with no charset line came out garbled until that line was added.

Convert a Folder With One LibreOffice Command

LibreOffice is free, and its command line can batch convert HTML to text for a whole folder. Paste the line below into PowerShell. Your TXT files will appear in a txt subfolder.

& "C:\Program Files\LibreOffice\program\soffice.com" --headless --convert-to "txt:Text (encoded):UTF8" --outdir "C:\HtmlToText\txt" (Get-ChildItem "C:\HtmlToText\*.htm*").FullName

Keep the :Text (encoded):UTF8 part. With a bare txt in that spot, the Hindi sample words turned into question marks.

Limitations: the command included hidden text and skipped the line that a script writes. Adjust the program path if your copy sits elsewhere.

Skip the 1-Line PowerShell Tag Stripper

You may come across a short command that deletes anything between angle brackets.

(Get-Content page.html -Raw) -replace '<[^>]+>' | Set-Content page.txt

On the sample pages that command left the title and the script code in the text. It also kept raw codes like &amp; and glued the list items together. Removing tags is only part of the job.

Convert HTML to TXT in Bulk Without Scripts

Rather than paste commands, you can load your pages into the 4n6 Document Converter, a Windows app with a TXT choice in its export list. See the HTML converter page for its other formats.

  1. Run the setup file and start the Windows converter.

    Download Free Demo

  2. Under Open, point to HTML Files and take either Choose Files or Choose Folders.
    Open menu expanded to HTML Files with two ways to load them
  3. Check that your pages appear under Selected HTML Files.
    Two loaded web pages listed beside the selected folder entry
  4. Expand Export and choose TXT.
    Export list of formats with the TXT entry outlined in red
  5. On TXT Export Options, set the Location with Browse, then select Save.
    TXT export settings showing a location box and Browse button
  6. In the demo, a message about the item limit appears. Select OK and open your output.
    Message box saying the demo edition exports only two items

Limitations: that message caps the demo at 2 items. The app’s TXT output wasn’t tested here, so compare it with your original pages.

Test 2 Pages That Matter to You

Choose one page with a table and one with accented words, then read both results in Notepad.

Download Free Trial Select a Licence From $29

5 Checks Before You Delete Any HTML Page

  • You have one TXT file for each source page.
  • Accented and non-Latin words read correctly.
  • No stray tags or codes are left in your text.
  • Table values still make sense when read in order.
  • Nothing hidden or private slipped into a copy you plan to share.

Want styling to survive? The same source pages work when you export HTML to rich text format.

3 TXT Export Problems and Their Fixes

Letters Turn Into Question Marks or Odd Symbols

A wrong encoding is the usual cause. Do this: save as UTF-8, and for Word add <meta charset="utf-8"> inside the head of any UTF-8 page that lacks it. Going the other way later? Read how to convert a text file to HTML.

Lines You Saw on Screen Are Missing

Text that a script builds may be absent from Word and LibreOffice output. Do this: load that page in your browser, wait for it to finish and copy the text from there. When pictures matter too, convert HTML to DOC instead.

Headings and Tables Lose Their Shape

Plain text has no way to mark a heading or draw a grid. Do this: keep the original page beside your TXT copy, or convert HTML to Markdown if the structure has to stay visible.

Frequently Asked Questions

How do I convert HTML to TXT?

Copy one page from your browser into Notepad. A folder can go through the Word script, the LibreOffice command or the 4n6 Document Converter for Windows.

Can I export an HTML file to TXT format in bulk?

Yes. Both commands above work through a whole folder, and the desktop converter loads folders too.

Can a TXT file hold Hindi or accented letters?

Yes. Saved as UTF-8, plain text can store them. It isn’t limited to ASCII characters.

Why do I see question marks in my text file?

The file was probably saved in an older encoding. Export your original page again with UTF-8 selected.

Are web links kept in the TXT file?

The clickable words stay, but the tested routes dropped the addresses behind them.

Can hidden page text end up in the export?

Yes. Word and LibreOffice both wrote out a block that the sample style sheet hid.

Are pictures saved in a TXT file?

No. Plain text can’t hold an image, so keep the picture folder if you’ll need it.

Do I need Microsoft Word to convert HTML to text?

No. A browser, LibreOffice or a separate converter can do the work without it.

Which TXT Route Suits Your Pages?

One page you can read now: copy it from your browser.

A folder on a PC with Word: run the script, then spot-check a few results.

A folder and no Office licence: use the LibreOffice command.

Menus over commands: run a handful of pages through the Windows app.

Google Preferred Source