User Rating 0.0 β˜…β˜…β˜…β˜…β˜…
Total Usage 0 times
BBCode to Markdown Converter
Supports: [b], [i], [u], [s], [url], [img], [quote], [code], [list], [table], [h1]-[h6], [hr], [color], [size], [center], [spoiler], [email], [youtube], [sup], [sub]
Is this tool helpful?

Your feedback helps us improve.

β˜… β˜… β˜… β˜… β˜…

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.

bbcode markdown converter text formatting bbcode to md forum markup

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:

f(input) = Rn Rnβˆ’1 … R1(input)

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 TagExample InputMarkdown OutputNotes
[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](http://x.com/a.png)Image embed
[img=WxH][img=100x200]url[/img]<img src="url" width="100" height="200">Sized image; HTML fallback
[quote][quote]text[/quote]> textBlockquote
[quote=author][quote=John]text[/quote]> **John wrote:**\n> textAttributed 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- bUnordered list
[list=1][list=1][*]a[*]b[/list]1. a\n2. bOrdered 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]# TitleHeadings
[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][![YouTube](https://img.youtube.com/vi/dQw4w9WgXcQ/0.jpg)](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

Frequently Asked Questions

The converter processes inline tags (bold, italic, underline, strikethrough) using non-greedy regex patterns that match the innermost tags first. Since Markdown supports nesting like ***text*** for bold+italic, the output composes correctly. For example, [b][i]text[/i][/b] becomes ***text***. Deep nesting beyond 3 levels may produce valid but verbose Markdown.
Tags like [color], [size], [center], [sup], and [sub] have no native Markdown syntax. The converter falls back to inline HTML, which is valid in most Markdown renderers (GitHub, GitLab, CommonMark). For example, [color=red]text[/color] becomes text. If your target renderer strips HTML, these will appear as plain text.
Yes. Before any tag replacement begins, [code] and [code=lang] blocks are extracted and replaced with unique sentinel tokens. All conversion passes operate on the sentinel-protected string. After conversion completes, sentinels are swapped back with the original content wrapped in Markdown fenced code blocks (```). This prevents false matches on BBCode-like patterns inside code samples.
The converter parses [table][tr][td]...[/td][/tr][/table] structures into GitHub Flavored Markdown (GFM) pipe tables. The first [tr] row becomes the header, and a separator row of |---| is inserted. If the original BBCode table has no logical header row, the first data row is still used as the header since GFM requires it. Column alignment defaults to left-aligned.
Partially. The regex patterns require both opening and closing tags to match. Unclosed tags like [b]text without [/b] will pass through unconverted, appearing as literal text in the Markdown output. This is intentional - guessing where a tag should close risks corrupting the document. The unconverted tags serve as visible indicators of source markup errors.
The converter runs entirely in your browser with no server round-trip. Practical limits are governed by browser memory and regex performance. Inputs up to approximately 500,000 characters convert in under 200ms on modern hardware. Beyond 1MB of text, you may notice a brief processing delay. LocalStorage persistence is capped at approximately 5MB by most browsers.