首页Home › 文本工具Text Tools

📄 从 HTML 提取纯文本Extract Text from HTML

去除 HTML 标签,提取可读的纯文本:自动删除 script 和 style 元素,在段落、标题、列表、br 换行和表格行处保留换行,表格单元格之间用空格分隔,pre 代码块保留原有空格和缩进,并还原 HTML 实体(如 & → &)。可选把链接显示为“文字 (网址)”。处理在本地完成,不执行页面脚本。Strip HTML tags to readable plain text — removes script and style elements, keeps line breaks at paragraphs, headings, lists, br tags and table rows (cells separated by spaces), keeps the spacing and indentation inside pre blocks, and decodes HTML entities (such as & → &). Optionally shows links as "text (url)". Processed locally; page scripts are never run.

使用说明与常见问题How-to & FAQ

「从 HTML 提取纯文本」是什么?What is the Extract Text from HTML tool?

去除 HTML 标签,提取可读的纯文本:自动删除 script 和 style 元素,在段落、标题、列表、br 换行和表格行处保留换行,表格单元格之间用空格分隔,pre 代码块保留原有空格和缩进,并还原 HTML 实体(如 & → &)。可选把链接显示为“文字 (网址)”。处理在本地完成,不执行页面脚本。Strip HTML tags to readable plain text — removes script and style elements, keeps line breaks at paragraphs, headings, lists, br tags and table rows (cells separated by spaces), keeps the spacing and indentation inside pre blocks, and decodes HTML entities (such as & → &). Optionally shows links as "text (url)". Processed locally; page scripts are never run.

如何使用「从 HTML 提取纯文本」?How do I use the Extract Text from HTML tool?

在「从 HTML 提取纯文本」中,把内容粘贴或输入到上方输入框,结果会实时显示在下方,点击「复制结果」即可复制。例如输入「<ul><li>a</li><li>b</li></ul>」,得到「• a ⏎ • b」。In the Extract Text from HTML: Paste or type into the input box; the result appears below instantly — click "Copy result" to copy it. Example: "<ul><li>a</li><li>b</li></ul>" → "• a ⏎ • b".

它和去除 HTML 标签有什么不同?How is this different from just stripping tags?

它用浏览器的 HTML 解析器理解结构:在段落、标题、列表项、表格行和 br 处换行,列表项前加项目符号,并把 &amp;、&lt;、&nbsp; 等实体还原为真实字符,得到接近“复制网页正文”的效果,而不是简单删尖括号。It uses the browser's HTML parser to understand structure: it breaks lines at paragraphs, headings, list items, table rows and br tags, bullets list items, and decodes entities such as &amp;, &lt; and &nbsp; into real characters — close to copying a page's text, rather than just deleting angle brackets.

会执行网页里的脚本吗?Does it run scripts in the HTML?

不会。解析使用 DOMParser,只构建文档结构、不执行任何脚本,script、style 和 head 元素会被直接删除,所以粘贴不受信任的 HTML 也安全。No. Parsing uses DOMParser, which builds the document structure without running any script; script, style and head elements are removed, so pasting untrusted HTML is safe.

能保留链接地址吗?Can it keep link addresses?

勾选“把链接显示为‘文字 (网址)’”后,链接会变成“链接文字 (https://…)”,方便保留出处;锚点(#)和 javascript: 链接会跳过。Tick "Show links as text (url)" and each link becomes "link text (https://…)", keeping the source; anchor (#) and javascript: links are skipped.

表格和列表会怎样?What happens to tables and lists?

表格的每一行单独成行(单元格之间用空格分隔),列表项每项一行并加上 • 符号。复杂排版(多列、合并单元格)只能线性展开,不保证还原原布局。Each table row becomes its own line (cells separated by spaces), and list items each take a line with a • bullet. Complex layouts (multiple columns, merged cells) are flattened linearly and the original layout is not reproduced.

处理大段文本会卡吗?Can it handle long text?

「从 HTML 提取纯文本」在浏览器中直接处理,几 MB 以内的文本通常瞬间完成;文本不会离开你的设备。The Extract Text from HTML runs in your browser; text up to a few MB is usually processed instantly and never leaves your device.

「从 HTML 提取纯文本」免费吗?需要注册吗?Is the Extract Text from HTML free? Do I need an account?

「从 HTML 提取纯文本」完全免费,无需注册或安装,打开网页即可使用,手机和电脑都能用;输入的内容只在你的浏览器本地处理。The Extract Text from HTML is completely free with no sign-up or install and works on phones and desktops; what you enter is processed only in your browser.

相关工具Related tools

📝 DOCX 转 TXT(Word 提取纯文本)DOCX to TXT Converter📝 ODT 转 TXT(OpenDocument 提取纯文本)ODT to TXT Converter📄 RTF 转换器(RTF 转 TXT / HTML / Word / PDF)RTF Converter (RTF to TXT / HTML / DOCX / PDF)📚 DOCX 转 EPUB(Word 转电子书)DOCX to EPUB Converter📝 TXT 转 Word(TXT 转 DOCX)TXT to DOCX Converter🔢 字数统计Word & Character Counter🔠 大小写转换Case Converter🧹 删除重复行Remove Duplicate Lines↕️ 文本行排序Sort Lines🆚 文本对比Text Diff Checker🔍 文本查找替换Find and Replace Text🔗 URL Slug 生成器URL Slug Generator

← 全部工具All tools