What is BBCode?
BBCode (Bulletin Board Code) is the lightweight markup used by forums such as phpBB, vBulletin, MyBB and SMF. Instead of HTML tags it uses square brackets: [b]bold[/b], [url=https://example.com]link[/url]. Forums adopted it because users could format posts without being allowed to inject arbitrary HTML. This BBCode to HTML converter translates those posts into standard HTML for websites, CMS imports and archives.
BBCode to HTML example
[b]Welcome to the forum![/b]
Please read the [url=https://example.com/rules]rules[/url].
[quote=Admin]Be kind and stay on topic.[/quote]
[list]
[*]Search before posting
[*][color=red]No spam[/color]
[/list]<strong>Welcome to the forum!</strong><br>
Please read the <a href="https://example.com/rules" rel="nofollow">rules</a>.<br>
<br>
<blockquote><cite>Admin wrote:</cite><br>
Be kind and stay on topic.</blockquote>
<ul>
<li>Search before posting</li>
<li><span style="color:red">No spam</span></li>
</ul>
Supported tags
| BBCode | HTML result |
|---|---|
[b] [i] [u] [s] | strong, em, u and s elements |
[url] [email] [img] | links, mailto links and images (with [img=WxH] sizes) |
[quote] [quote=Name] | blockquote, with "Name wrote:" attribution |
[code] [icode] [noparse] | pre/code blocks and inline code; contents are not parsed |
[list] [list=1] [*] | bulleted and numbered lists (also a, A, i, I) |
[color] [size] [font] [highlight] | styled spans and mark |
[center] [left] [right] [align] | aligned div elements |
[table] [tr] [td] [th] | HTML tables |
[spoiler] [youtube] [hr] [h1]–[h6] | details/summary, embedded video, rules and headings |
[size] accepts both the classic 1–7 scale and pixel or percentage values, because different forum packages use different conventions.
Safe output
Links get rel="nofollow", the usual convention for user-generated content. Text is HTML-escaped, so a post containing <script> shows the characters instead of running them. Links using javascript:, data: or other non-web schemes are dropped, and color and font values are filtered to plain CSS. Unknown tags such as [foo] are left as text rather than guessed at. Still, sanitize imported content on the server as well if it came from untrusted users.
Migrating a forum
When moving an old community to a new platform, convert posts in batches and spot-check the ones with nested quotes, tables and code. Unclosed tags are closed automatically at the end of the post. You can preview rendering with the BBCode viewer, convert the other way with HTML to BBCode, or go on to Markdown with HTML to Markdown if your new platform prefers it. Conversion runs in your browser.
Common BBCode problems and how they convert
- Overlapping tags. Forum posts often contain
[b][i]text[/b][/i]. HTML does not allow elements to overlap, so check the output of such posts and fix the source order to[b][i]text[/i][/b]if the formatting ends up wrong. - Forum-specific tags. Plugins added tags such as
[attachment]or[mention]that only exist on one platform. They stay as visible text, which makes them easy to search for and replace after the import. - Smileys. Codes like
:)are plain text in BBCode and were turned into images by the forum software, so they come through as text. - Relative image paths.
[img]/uploads/pic.png[/img]only works if the files move to the same path on the new site; update the paths or copy the upload folder.