BBCode to Markdown Converter
Convert BBCode to Markdown instantly. Supports bold, italic, links, images, lists, code blocks, quotes, tables, and nested tags.
About
BBCode originated in bulletin board systems as a safe markup subset of HTML. Markdown, defined by John Gruber in 2004, now dominates documentation platforms, static site generators, and repository READMEs. Migrating forum content or legacy CMS data from BBCode to Markdown requires accurate tag-to-syntax mapping. Manual conversion introduces transcription errors: a misplaced * breaks list nesting, and an unclosed fence destroys code formatting downstream. This tool performs deterministic, regex-based conversion across 25 BBCode tag types, including nested structures like [list] inside [quote]. It preserves content inside [code] blocks verbatim, preventing double-escaping. Note: BBCode has no formal specification. Vendor-specific tags (e.g., phpBB's [attachment]) that lack a Markdown equivalent are stripped to plain text with a comment annotation.
Formulas
The converter applies a deterministic multi-pass replacement pipeline. Each BBCode tag T is mapped to a regular expression R and a replacement template M. The conversion function f is a composition:
Where each Ri is a global regex replacement: str.replace(patterni, templatei). Order constraint: [code] blocks are extracted first and replaced with sentinel tokens %%CODE_n%% to prevent inner parsing. After all other replacements complete, sentinels are restored. [list] blocks use a dedicated parser that counts [*] items sequentially, assigning index i = 1, 2, β¦ for ordered lists. Nested tags are handled by the natural greediness of inner-match-first regex ordering.
Reference Data
| BBCode Tag | Example Input | Markdown Output | Notes |
|---|---|---|---|
| [b] | [b]text[/b] | **text** | Bold |
| [i] | [i]text[/i] | *text* | Italic |
| [u] | [u]text[/u] | <u>text</u> | No native MD; uses HTML |
| [s] | [s]text[/s] | ~~text~~ | Strikethrough (GFM) |
| [url] | [url=http://x.com]click[/url] | [click](http://x.com) | Inline link |
| [url] (bare) | [url]http://x.com[/url] | <http://x.com> | Auto-link |
| [img] | [img]http://x.com/a.png[/img] |  | Image embed |
| [img=WxH] | [img=100x200]url[/img] | <img src="url" width="100" height="200"> | Sized image; HTML fallback |
| [quote] | [quote]text[/quote] | > text | Blockquote |
| [quote=author] | [quote=John]text[/quote] | > **John wrote:**\n> text | Attributed quote |
| [code] | [code]x=1[/code] | ```\nx=1\n``` | Fenced code block |
| [code=lang] | [code=python]x=1[/code] | ```python\nx=1\n``` | Syntax-highlighted fence |
| [list] | [list][*]a[*]b[/list] | - a\n- b | Unordered list |
| [list=1] | [list=1][*]a[*]b[/list] | 1. a\n2. b | Ordered list |
| [color] | [color=red]text[/color] | <span style="color:red">text</span> | HTML fallback |
| [size] | [size=20]text[/size] | <span style="font-size:20px">text</span> | HTML fallback |
| [center] | [center]text[/center] | <div align="center">text</div> | HTML fallback |
| [hr] | [hr] | --- | Horizontal rule |
| [h1]-[h6] | [h1]Title[/h1] | # Title | Headings |
| [table] | [table][tr][td]A[/td][/tr][/table] | | A |\n|---| | GFM table |
| [spoiler] | [spoiler]text[/spoiler] | <details><summary>Spoiler</summary>text</details> | HTML details element |
| [email] | [email][email protected][/email] | [[email protected]](mailto:[email protected]) | Mailto link |
| [youtube] | [youtube]dQw4w9WgXcQ[/youtube] | [](https://www.youtube.com/watch?v=dQw4w9WgXcQ) | Thumbnail link |
| [sup] | [sup]2[/sup] | <sup>2</sup> | Superscript HTML |
| [sub] | [sub]2[/sub] | <sub>2</sub> | Subscript HTML |