BBCode Converter, Explained

After reading this you will know what BBCode is, how it maps onto HTML and Markdown, and how to convert a forum post cleanly without losing the tags a converter cannot understand.

What BBCode is

BBCode (Bulletin Board Code) is a lightweight markup language that uses square-bracket tags instead of angle-bracket HTML tags. You write [b]hello[/b] and the forum shows hello. It appeared on 1990s message boards as a safe substitute for raw HTML: forum owners wanted users to bold text and post links without letting them inject <script> tags or broken markup that could wreck a page.

The idea is deliberately small. A tag opens with [name] and closes with [/name], and some tags take an argument, as in [url=https://example.com]click[/url]. Because forums each rolled their own parser, there is no single standard. phpBB, vBulletin, and MyBB all support the core tags but disagree on the edges, especially [table], [color], and custom smilies.

Here is the hook. This BBCode:

[quote][b]Ada[/b] wrote:[/quote] See [url=https://example.com]the docs[/url].

becomes this HTML:

<blockquote><strong>Ada</strong> wrote:</blockquote> See <a href="https://example.com">the docs</a>.

or this Markdown:

> **Ada** wrote: followed by See [the docs](https://example.com).

When to use it, and when not

Convert BBCode when you are migrating content off a forum. A phpBB export, a copied signature, a pasted quote from an old thread: all of these carry BBCode that your new system does not render. A blog engine wants HTML or Markdown. A static site generator wants Markdown. A plain-text log wants no tags at all. The converter handles all three targets.

Do not convert when the destination already understands BBCode. Some forums and Discourse plugins still parse it. Converting there just doubles the work and can break tags the target would have handled natively.

Converting to plain text is lossy on purpose. It removes formatting and keeps the words. Converting to HTML or Markdown is meant to be reversible in spirit, but round-tripping is never guaranteed because BBCode dialects carry information the target formats cannot represent.

How the mapping works

A converter is a small tree transformer. It reads the BBCode, builds a tree of nested tags, then walks that tree and emits the target syntax for each node. The core mapping is a lookup table. Each BBCode tag has a known equivalent, and anything not in the table is left exactly as written so nothing disappears silently.

Core BBCode tags and their equivalents
BBCodeHTMLMarkdown
[b]x[/b]<strong>x</strong>**x**
[i]x[/i]<em>x</em>*x*
[u]x[/u]<u>x</u>x (no syntax)
[url=U]x[/url]<a href="U">x</a>[x](U)
[quote]x[/quote]<blockquote>x</blockquote>> x
[code]x[/code]<pre><code>x</code></pre>fenced block

Notice the gaps. Markdown has no underline, so [u] either drops to plain text or falls back to raw HTML. That gap is not a bug in the converter; it is a real difference between the two formats. When a source construct has no target equivalent, something must give, and the honest choices are to drop the styling or to emit raw HTML inside the Markdown.

Why unknown tags are passed through

The rule is simple: if a tag is not in the lookup table, print it unchanged. Consider a vBulletin post with [spoiler]ending[/spoiler]. No standard maps that tag, and dialects disagree on what it should become. A converter that guessed would sometimes guess wrong and destroy meaning. Passing it through means you keep the text ending and a visible marker that a human can fix later.

The same holds for [table]. phpBB, vBulletin, and MyBB each write table rows differently, and the cell separators are not consistent. Guessing a single HTML table structure would silently reorder or merge cells. Leaving the tags intact loses nothing.

Passed-through tags are not errors, but they are also not finished. Search your output for stray [ and ] characters after converting. Any that remain mark a tag the converter did not recognize and you must handle by hand.

Worked example: the demo post

Take a short post that uses the core tags. Paste it into the tool and press Convert.

Input:

[b]Notes[/b] [list] [*]Read [url=https://example.com/spec]the spec[/url] [*][i]Test[/i] the parser [/list] [quote]Nested [b]works[/b][/quote]

  1. The parser reads [b]Notes[/b] and emits <strong>Notes</strong> for HTML, or **Notes** for Markdown.
  2. It sees [list] and opens an unordered list. Each [*] starts one item.
  3. Inside the first item, [url=...] becomes an anchor in HTML: <a href="https://example.com/spec">the spec</a>, or a Markdown link [the spec](https://example.com/spec).
  4. The second item wraps Test in <em> or *...*.
  5. The [quote] node contains a nested [b], so the converter recurses: <blockquote>Nested <strong>works</strong></blockquote>.

The HTML output is:

<strong>Notes</strong> <ul> <li>Read <a href="https://example.com/spec">the spec</a></li> <li><em>Test</em> the parser</li> </ul> <blockquote>Nested <strong>works</strong></blockquote>

Count the mapping. The input has 6 opening tags and 6 closing tags plus 2 list markers. All 6 tag pairs are in the table, so 0 tags pass through. That zero is the number to check: a clean conversion of core tags should leave no brackets behind.

Given the fixed input [b]Hi[/b] [u]there[/u] [url=https://x.com]link[/url], HTML output is <strong>Hi</strong> <u>there</u> <a href="https://x.com">link</a>; Markdown output is **Hi** there [link](https://x.com) (underline dropped); plain text is Hi there link.

Reading the output

Judge a conversion by two numbers: passed-through tags and dropped styling. Passed-through tags are literal brackets left in the output. Dropped styling is formatting the target cannot express, such as color or underline in Markdown.

The chart below shows how many of the core tags survive intact into each target. HTML preserves all 6 core constructs. Markdown preserves 5 (it has no underline). Plain text preserves 0 constructs by design, keeping only the words.

HTML keeps every core construct; Markdown loses underline; plain text keeps none, only the words.

If you expected 6 preserved constructs in Markdown but got 5, the missing one is almost always underline. That is expected, not a failure.

Common mistakes

The most frequent problem is unbalanced tags. A post with [b]bold[i]both[/b]still italic[/i] crosses its nesting. Strict parsers close [i] when they hit [/b], so still italic may lose its emphasis. Fix the source order before converting.

The second is assuming Markdown can hold everything HTML can. It cannot. Colors, font sizes, and underline have no Markdown syntax, so convert to HTML when you need those, or accept the loss.

The third is forgetting that [code] blocks should be left literal. If a code block contains [b] as sample text, the converter must not treat it as a bold tag. Check that code content survives byte for byte.

Convert a small sample first, read it, then convert the whole batch. A five-line test catches dialect quirks faster than scanning a thousand-line dump for stray brackets.

Related tools

Once your BBCode is Markdown, you may want to preview it as HTML or edit it further. The Markdown ↔ HTML Converter converts Markdown to HTML and back with a live preview, which pairs well with a BBCode to Markdown pass.

Terminology

Tag
A bracketed instruction like [b] (opening) or [/b] (closing) that marks where formatting starts and stops.
Dialect
One forum software's particular set of BBCode tags and rules. phpBB and vBulletin are different dialects.
Pass-through
Leaving an unrecognized tag in the output unchanged, so no text is lost.
Lossy conversion
A conversion that cannot preserve all source information, such as BBCode to plain text.

Frequently asked questions

Does the converter send my text anywhere?

No. It runs entirely in your browser. Nothing you paste leaves your device, so you can convert private forum exports safely.

Why did some tags stay as brackets in the output?

Those tags are not in the standard mapping, so the converter left them unchanged rather than guessing. Custom tags, smilies, and dialect-specific extensions do this. Search the output for [ to find and fix them.

Can it convert nested quotes and lists?

Yes. Nesting is handled by recursion, so a quote inside a quote, or a list inside a list, converts correctly. Only [table] is passed through, because table dialects vary too much to convert safely.

Why does bold survive but underline does not when I pick Markdown?

Markdown has syntax for bold (**x**) and italic (*x*) but none for underline. There is nothing to convert to, so the styling is dropped. Choose HTML if you need underline.

Is HTML output safe to paste into a web page?

The core tags produce standard, well-formed HTML. Review any passed-through content before publishing, since unrecognized tags remain as literal text and are not sanitized.