Pricing Dashboard Sign up
Recent
· 5 min read · MDisBetter

How to Extract Text from a Word Document (5 Methods)

To extract plain text from Word, save the document as .txt or paste selected content into a plain-text editor. Pandoc and Mammoth offer local DOCX workflows. Choose Markdown when retaining headings and links matters; it is a different output from unformatted text.

Choose an output before the tool

MethodOutputUseful when
Word Save As.txtYou already have Word
Copy selected textText in an editorYou need a short passage
PandocPlain text or MarkdownYou want local command-line processing
MammothRaw text or HTMLYou are building a JavaScript import
MDisBetterMarkdownYou want hosted structured conversion

1. Save Word as plain text

  1. Open the document in a Word version offering plain-text export.
  2. Choose Save As or Save a Copy, then Plain Text (.txt).
  3. Check the encoding preview; UTF-8 is a useful portable choice when offered.
  4. Save a separate copy and retain the original DOCX.
  5. Reopen the text file and check tables, lists and non-English characters.

Menu names vary by Word version. Microsoft documents text encoding and saving. Plain text cannot preserve Word page layout, images or rich formatting. Check important document elements rather than assuming all were exported.

2. Copy a selected passage

Paste into Notepad or another plain-text editor and save as .txt. A rich-text destination may retain formatting instead. See Word copy-paste formatting issues for CMS workflows.

Inspect text boxes, footnotes, comments and tables separately when they matter. Content outside your selection can be missing.

3. Use Pandoc locally

After installation, choose the output explicitly:

pandoc -f docx -t plain input.docx -o output.txt
pandoc -f docx -t gfm input.docx -o output.md

The second command produces Markdown. Retaining image files requires --extract-media and path checks; see the manual.

4. Use Mammoth for JavaScript extraction

After installing Mammoth, a Node.js raw-text example is:

const fs = require("node:fs/promises");
const mammoth = require("mammoth");

async function main() {
  const result = await mammoth.extractRawText({ path: "input.docx" });
  await fs.writeFile("output.txt", result.value, "utf8");
  console.log(result.messages);
}
main().catch(error => { console.error(error); process.exitCode = 1; });

Check both text and messages. For structured imports, convertToHtml is a separate method; direct Markdown conversion is deprecated. Consult the maintainer documentation. HTML from untrusted uploads needs appropriate sanitization before rendering.

5. Use a hosted Markdown workflow

Sign in and open Word to Markdown. Upload the DOCX, convert with available credits and download the .md file. Several files can be submitted in the web interface.

This is structured text, not a claim of plain .txt output. Embedded images become generated descriptions, which can contain errors. Compare important facts and tables with the original.

Verify the result

Check the beginning, ending and an important middle passage. Review table cells, list order and any relevant comments or revisions. Keep the original and note omissions.

See PDF, Markdown and TXT as inputs and Word-to-text preparation for representation choices. Other sources need their own routes: PDF extraction and web article extraction.

Frequently asked questions

How do I extract plain text from DOCX?
Use Word plain-text export, paste into a plain-text editor, or choose an explicit plain-text output in a local converter. Save a separate .txt file and check it.
Can I extract DOCX text without Microsoft Word?
Tools such as Pandoc or Mammoth can read supported DOCX files. A hosted converter is another choice for Markdown. Setup and output requirements differ.
Does renaming .docx to .txt extract text?
No. Renaming changes the filename, not the format. Use a compatible document reader or converter.
Will extraction include words inside images?
Ordinary text extraction does not establish OCR of images. Use an appropriate image-text workflow and verify the result. Generated descriptions can differ from the source.
Does MDisBetter require signup?
Yes. An account and available credits are required for Word conversion. It returns Markdown, which is different from plain-text output.