Markdown to BBCode Converter
Convert Markdown syntax to BBCode format instantly. Supports headers, lists, links, images, bold, italic, code blocks, tables, and nested elements.
About
BBCode remains the dominant markup language across legacy forum platforms (phpBB, vBulletin, SMF, XenForo). Writers who draft in Markdown face a manual rewriting burden when posting to these systems. Incorrect conversion loses formatting: broken nested lists collapse into flat text, mismatched tags produce rendering artifacts, and unescaped code blocks leak raw syntax into posts. This converter implements a multi-pass regex tokenizer that processes block-level elements (headers mapped to size tags, fenced code to code blocks, ordered and unordered lists to list structures) before inline elements (bold, italic, strikethrough, links, images). Code blocks are extracted into placeholders before any transformation pass, preventing inner content from being parsed as Markdown. The tool handles nested lists up to 4 levels, GFM-style tables converted to BBCode table tags, and reference-style links.
Limitations: BBCode has no standard specification. Tag support varies by forum software. This tool targets the common subset recognized by phpBB, vBulletin, and XenForo. Tags like [table] may not render on all platforms. Horizontal rules have no BBCode equivalent and are approximated with a text separator. Inline HTML within Markdown is stripped. Test output on your target forum before bulk-posting.
Formulas
The converter applies a deterministic transformation pipeline. Each Markdown token class maps to a BBCode tag via pattern substitution. The processing order is critical to avoid conflicts between block and inline patterns.
Where md is the raw Markdown input string, extractCodeBlocks replaces fenced and indented code with indexed placeholders (%%CODE_n%%), convertBlocks processes headers, blockquotes, lists, tables, and horizontal rules via regex, convertInlines handles bold, italic, strikethrough, links, images, and inline code, and restoreCodeBlocks reinserts the original code content wrapped in [code] tags.
Where n is the heading level (1 - 6) and the resulting BBCode size value ranges from 7 down to 2. Each heading is additionally wrapped in [b] tags for visual weight.
Reference Data
| Markdown Syntax | BBCode Output | Notes |
|---|---|---|
# Heading 1 | [size=7][b]...[/b][/size] | Largest size tier |
## Heading 2 | [size=6][b]...[/b][/size] | Second tier |
### Heading 3 | [size=5][b]...[/b][/size] | Third tier |
#### Heading 4 | [size=4][b]...[/b][/size] | Fourth tier |
**bold** | [b]bold[/b] | Also __bold__ |
*italic* | [i]italic[/i] | Also _italic_ |
~~strike~~ | [s]strike[/s] | GFM extension |
`inline code` | [code]inline code[/code] | Single backticks |
```code block``` | [code]...code...[/code] | Fenced blocks preserved verbatim |
[text](url) | [url=url]text[/url] | Inline links |
 | [img]src[/img] | Alt text is dropped (no BBCode equiv) |
> quote | [quote]quote[/quote] | Multi-line supported |
- item | [list][*]item[/list] | Unordered list |
1. item | [list=1][*]item[/list] | Ordered list |
--- | ――――――――― | No BBCode HR; text approximation |
| A | B | | [table][tr][td]A[/td][td]B[/td][/tr][/table] | GFM tables; not all forums support |
\n\n | Double newline | Paragraph break preserved |
Nested **_bold italic_** | [b][i]bold italic[/i][/b] | Proper nesting order maintained |