Remove Markdown From Text: Asterisks, Hashes and Links
To remove Markdown from text, strip the symbols that mark formatting: asterisks around bold words, hashes in front of headings, backticks around code and the brackets and address in links. You can do it by hand with find and replace, or switch on one option in a cleaner. This guide shows how to remove Markdown from text pasted from AI chats and notes apps, which syntax the cleaner handles, and which patterns to use for the rest.
Why Markdown shows up in copied text
Markdown is a plain-text way to write formatting. Typing **word** means bold, a line starting with # is a heading, and - or * at the start of a line makes a list. A program that understands Markdown turns those symbols into real formatting. A program that does not shows the symbols as they are.
AI chat tools write their answers in Markdown. Depending on the interface and on how you copy, you may get styled text or the raw symbols. Using a Copy button often gives the raw Markdown, and dragging to select the displayed text often gives the styled version. Notes apps, README files and documentation sites are other common sources.
| Markdown | Meaning | Plain result |
|---|---|---|
**bold** or __bold__ | Bold text | bold |
*italic* or _italic_ | Italic text | italic |
~~gone~~ | Strikethrough | gone |
# Heading to ###### Heading | Headings, level 1 to 6 | Heading |
- item, * item, + item | Bulleted list | - item |
1. item | Numbered list | 1. item (numbers are kept) |
`code` | Inline code | code |
[label](address) | Link | label |
> quote | Block quote | quote |
--- | Horizontal rule | (a blank line) |
Remove Markdown with the cleaner
- Open the AI Text Cleaner.
- Tick Strip Markdown formatting in the options. It is off by default.
- Paste your text into the input box.
- Copy the cleaned text from the output box.
Here is a small example of what happens:
Input:
## Summary
**Key point:** run `npm install`.
* First item
* Second item
See [the docs](https://example.com).
Output:
Summary
Key point: run npm install.
- First item
- Second item
See the docs.
Exactly what the option handles
| Handled | How |
|---|---|
Headings # to ###### | The hashes and the space after them are removed. A hash with no space, such as a hashtag, is left alone |
Bold with ** or __ | The markers are removed and the words stay |
Italic with * or _ | Markers removed. An underscore inside a word, as in snake_case, is left alone |
Strikethrough ~~ | Markers removed |
| Inline code in backticks | Backticks removed |
Fenced code lines that start with ``` | The fence lines are removed. The code between them stays |
Links and images [label](address) | Replaced by the label. The address is dropped |
Block quote markers > at the start of a line | Removed |
Horizontal rules made of three or more -, * or _ | The line is cleared |
Bullets *, + and • | Converted to - , so lists stay readable |
Web addresses written out in the text are protected, so an underscore or asterisk inside a URL is not damaged.
What it leaves alone
- Numbered lists such as
1.and2.. They are valid plain text. - Tables. The pipe characters and the row of dashes under the header stay.
- Raw HTML tags, footnotes and reference-style links.
- Backslash escapes such as
\*. - Checkbox marks such as
[ ]and[x]at the start of tasks.
The option is meant for prose. It removes backticks and asterisks everywhere, so leave it off when the text is code, a formula or a regular expression.
Remove Markdown from text by hand with find and replace
For anything the option does not cover, use find and replace with regular expressions switched on. In Visual Studio Code, click the .* button first. Most editors write a captured group in the replacement as $1.
| Remove | Find | Replace with |
|---|---|---|
| Bold | \*\*(.+?)\*\* | $1 |
| Italic with asterisks | \*(.+?)\* | $1 |
| Headings | ^#{1,6}\s+ | nothing |
| Links | \[([^\]]+)\]\([^)]+\) | $1 |
| Inline code | `([^`]+)` | $1 |
| Bullet markers | ^(\s*)[-*+]\s+ | $1- |
| Block quote markers | ^>\s? | nothing |
Run the bold pattern before the italic one. Otherwise the italic rule eats half of each double asterisk and leaves stray markers. If you only need to remove the double asterisks, a plain find and replace of ** with nothing works in Word, Google Docs and any other editor, with no regular expressions needed.
A tool for whole files
For converting whole Markdown files, the command-line tool Pandoc can write plain text from a Markdown source:
pandoc input.md -t plain -o output.txt
It understands tables, nested lists and footnotes, which the options above do not. If you want styled text instead of plain text, a Markdown preview in an editor shows the rendered result, which you can copy.
Problems you may hit
- Asterisks used as multiplication or footnote marks. A pattern that looks for a pair of asterisks can remove text between two of them that were never meant as formatting. Check the output.
- Underscores in names and filenames. Patterns for underscores can break
file_name_final. The cleaner only treats an underscore as formatting at the edge of a word, but hand-written patterns often do not. - Lost link addresses. After removal, the web addresses are gone. Copy them separately if you need them.
- Hidden characters left over. Text from chat tools often carries curly quotes, long dashes and invisible characters too. Our guide to long dashes in AI text covers one of them. The default options handle the rest.
Quick answers
How do I remove asterisks from text? Tick Strip Markdown formatting in the cleaner, or find ** and replace it with nothing for bold markers.
How do I remove hashtags-style headings from copied text? Remove the leading # characters and the space after them. The cleaner does it, and the pattern ^#{1,6}\s+ does it in an editor.
Does removing Markdown change the words? No. It removes the symbols and keeps the text, apart from the addresses inside links.