The full upstream README, mirrored here for reference. Install config, tool schemas, adoption signals, and an original overview live on the Markdown To Whatsapp listing page.
Convert standard Markdown into WhatsApp's formatting syntax — as a web page, an npm library, a command line tool or an MCP server for agents.
npm i markdown-to-whatsapp · npx markdown-to-whatsapp mcp
WhatsApp uses a non-standard syntax for text formatting (e.g., *bold*, _italic_, ~strikethrough~). This is similar, but not identical, to standard Markdown.
This tool provides a simple way to convert text from Markdown sources (like text editors, Google Docs, etc.) into the format that WhatsApp expects, saving the need for manual correction.
The entire conversion process runs locally in your browser using JavaScript, and the parser ships with the page. No data is ever sent to a server — the only request that leaves the page is for the font.
The script uses the marked library for proper AST-based parsing and handles:
**text** → *text**text* or _text_ → _text_~~text~~ → ~text~`code` → `code`***text*** → _*text*_ (preserves both styles)Headings are converted to bold text with level-specific emoji prefixes:
# H1 → *📌 H1*## H2 → *🟠 H2*### H3 → *🟡 H3*The emoji prefix can be turned off in the UI (Headings · Emoji), leaving plain *Title*.
* prefix with ◦ for nested levels
* Item* ◦ Item* ◦ ◦ Item◦ marking nested levels
1. A / ◦ 1. A1 / ◦ ◦ 1. A1a / 2. B- [x] → ☑, - [ ] → ☐, also inside ordered lists (1. ☑ done)A WhatsApp bubble fits a fixed number of monospace characters on one line — about 26 on a 360 px phone, which is the default. Measure yours by sending yourself a code block and counting where it breaks, then set Width in the bar to that (the ? next to it says the same). The field accepts 10 to 80: no phone is outside that range.
The number is a property of the phone, not of any one table, so it governs everything monospace: tables degrade to stay under it, and the preview draws every code block exactly that wide, wrapping where the recipient's WhatsApp will wrap.
A table is rendered in one of two styles, chosen in the UI for the whole document or for one table at a time:
Auto (default): a drawn table inside a monospace block, as wide as it needs and never wider than the bubble — and the bulleted list when no box can be drawn at all.
List: always the bulleted list.
How the list is laid out
A list can group the cells in three ways. The converter guesses from the headers and the bold cells, and the guess can be overridden per table (Layout: Auto · Rows · Columns · Pairs):
Pairs — 2 columns, whatever the headers: each row is a key: value line. Spelling the headers out on every row reads worse than Italy: Rome in nearly every table.
Columns — 3+ columns whose first header is empty or names a property ("Feature", "Spec", "Parameter"…), or whose first column is bold: a comparison matrix, where the things compared are the columns, so each column becomes a group.
Rows — everything else: one group per row, labelled by its first cell.
The property words are matched word by word ("Species" does not count as "spec") in 11 languages: English, Italian, Spanish, French, Portuguese, German, Russian, Arabic, Hindi, Bengali, and Indonesian. Pairs need exactly two columns; asked for on a wider table, it reads as Rows.
How the box degrades
The box is not drawn at any width: it degrades until it fits monoWidth, and becomes a list when nothing does. There is no way to ask for a table wider than the bubble.
Whether a tall wrapped box reads better than the list is a judgement the preview lets you make: that table's own panel switches it to List. A table that cannot fit any box says so in its panel and offers the list layout instead of a style that could not change anything.
Additional table behaviour
✅, 日本語 count as two columns) — as far as the phone allows: those glyphs come from a fallback font too, so the alignment is best effort, unlike the ASCII borders.:---, :---:, ---:) is honoured in the box and compact styles.<br> inside a cell becomes a space, and an escaped \| becomes ¦ so it cannot fake an extra column.+-|=), on purpose. WhatsApp's monospace font has no box-drawing glyphs: a phone takes ─ and ┌ from whatever fallback font it has, at whatever width that font gives them, and a rule of 26 of them wraps onto two lines while the text rows next to it do not. +-| are the only characters whose width a monospace font actually promises — which is also why the escaped pipe becomes ¦, a Latin-1 character from the same font as à.Fenced and indented blocks reach WhatsApp verbatim: the converter never re-wraps or re-indents them, since a line break inside code is content, not layout. WhatsApp wraps long lines by itself, mid-word, and a chat bubble has no horizontal scroll — so the preview reproduces that wrap at monoWidth instead of scrolling, and shows exactly where the recipient will see the break.
[text](https://github.com/drsound/markdown-to-whatsapp/blob/HEAD/url) → text (url); autolinks, <https://x>, [url](https://github.com/drsound/markdown-to-whatsapp/blob/HEAD/url) and <me@x.com> render as the bare URL or address (no duplication, no mailto: leak)café → café, © → ©, A → A). Rarer references (Greek, mathematical) are left as written.<b>/<strong> → *, <i>/<em> → _, <s>/<del> → ~, <code> → `, <br> → newline; comments and other tags are stripped> prefix, supports nesting (> > nested)ˋˋˋ so it cannot close the block early--- → ───────────────∗, _, ∼) so WhatsApp won't interpret them as formattingsuper**bold**ly → superboldly (WhatsApp doesn't support mid-word formatting)**Name**: value → *Name*: value, and so are (**x**) and **end**..md file into the left panel. "Try an example" fills it with a sample message.wa.me. A very long message does not fit in a link — browsers cut URLs past a few thousand characters — so Share steps aside and says to copy instead.The interface follows the operating system's light or dark theme; the header toggle overrides it and that choice is remembered. The options bar has one section per kind of content, each shown only while the text contains it: Bubble (the width, when there is a table or a code block), Tables (style and separator) and Headings (the emoji prefix). A control that another setting makes pointless — the separator in List style, the width with nothing monospace to draw — is dimmed in place rather than removed, so the bar keeps its shape. The options are stored in localStorage along with the theme. Per-table choices are not stored: they belong to the text being converted.
The same converter is published on npm as markdown-to-whatsapp (Node 20 or newer). The options are the ones described above, with the same names and defaults, and are listed in full at the end of this section.
--width (10–80), --tables auto|list, --layout auto|rows|columns|pairs, --separator, --no-emoji, --json, plus -h, --help and -v, --version. Output goes to stdout; a bad option says why on stderr and exits 2.
The package runs as a Model Context Protocol server over stdio, so an agent can convert text itself — which matters for tables: counting columns against a 26-character bubble is what a model gets wrong and this tool gets right.
or, for Claude Desktop and other clients that take a JSON configuration:
It exposes one tool, convert_markdown_to_whatsapp, taking markdown plus the optional monoWidth, tableFormat, listLayout, rowSeparator and headingEmojis. The text comes back as the tool's content, and the structured result carries it as text together with tables: one entry per table with key, columns, fitsBox, asList and listLayout, so the agent can tell which tables became a box and which a list. The tool is read-only and idempotent.
Options are tableFormat (auto | list), monoWidth, rowSeparator, headingEmojis, listLayout (auto | rows | columns | pairs), and tableOverrides — either an array indexed by the table's position in the document or an object keyed by the table's key (its header texts joined with |, plus #2, #3… for repeated headers), each entry overriding any of the others for that table alone. The page exposes listLayout per table only.
The older names are still accepted on input: tableThreshold for monoWidth, and ascii / always for tableFormat (ascii never drew a box wider than the bubble, so it maps to auto). When both the old and the new name are given, the new one wins and the old is dropped. borderStyle, which used to choose Unicode box drawing, is accepted and ignored.
Node 20 or newer, from the repository root:
The test suite uses file-based testing:
tests/inputs/*.md - Markdown input filestests/inputs/*.json - optional per-fixture converter options (e.g. { "monoWidth": 40 })tests/expected/*.txt - Expected WhatsApp outputplus a few invariants: the vendored parser matches the installed one, convertToBlocks reports the right source lines, the package entry is the page script.
Tests also run in CI on every push and pull request (.github/workflows/test.yml).
docs/converter.js - the converter itself: a pure ES module, DOM-free, options passed as a parameter. It is both the script the page imports and the entry point of the npm package (exports["."]), so there is one copy and no build step. It exposes convertTextToWhatsapp(markdown, options), convertToBlocks(markdown, options) — the same conversion with the top-level blocks kept apart and each one tagged with the table it came from, which is what per-table options are built on — and the mdContainsTable / mdContainsHeading / mdContainsCode queries the UI uses to show an option only when it applies. Each block of convertToBlocks reports the source line it starts on — what keeps the two panels scrolling together — and each table block also its key, columns, fitsBox (a box is possible), asList (what was written) and listLayout, so the interface can offer exactly the choices left.docs/ui.js - page wiring: theme, contextual options, WhatsApp preview, scroll sync between the panels, copy and sharedocs/index.html, docs/style.css - markup and hand-written stylesheet (no CSS framework)docs/vendor/ - the ES build of marked, copied from node_modules by npm run vendor; the page's import map resolves marked to itbin/markdown-to-whatsapp.js - the command line tool; bin/mcp.js - the MCP server it starts on mcp, loaded only then so converting a file never loads the protocol SDKscripts/vendor.js - copies the marked ES build into docs/vendor/ (npm run vendor)tests/ - the fixtures and the runnerThe marked version is pinned to 18.0.10 in package.json, and the copy the page loads from docs/vendor/ is checked against it by the test suite, so the page, the package and the tests always parse Markdown the same way. To bump it: change the pin, npm install, npm run vendor, npm test.
MIT, see the LICENSE file.