Skip to content
ZeroServer.tools

HTML to BBCode

Convert HTML to BBCode forum markup. Transforms tags to their BBCode equivalents for forum posts.

HTML to BBCode conversion

Converting HTML to BBCode is useful when posting content from a CMS or rich-text editor to a forum like phpBB, vBulletin, or SMF. This converter handles the most common HTML tags: bold, italic, underline, strikethrough, links, images, blockquotes, code blocks, and lists, including nested lists and quotes. Headings become bold lines, since BBCode has no portable heading tag, and a table, which most forums cannot show, becomes one line per row with its cells separated by bars. Line breaks follow what a browser shows: a newline in the HTML source is a space, and paragraphs, quotes, code blocks and lists are set apart by a blank line. Scripts, styles and comments are removed, other tags are reduced to their text, and named and numeric HTML entities are decoded. All processing runs entirely in your browser.

Built and maintained by Meet Shah · Last updated

What this tool is used for

  • Posting formatted content to a forum that accepts BBCode rather than HTML.
  • Converting an article for a legacy forum thread.
  • Adapting content from a CMS for a community board.
  • Producing a signature or a template for forum software.
  • Migrating posts into a BBCode-based platform.

How it works in practice

A worked example

A game-mod author is copying the release notes for version 2.4.1 from the project's website into an announcement on a forum that accepts BBCode but not HTML.

Input
<p><strong>Version 2.4.1</strong> fixes the save-game crash &amp; adds a config guide.</p>
<ul>
<li>Fixed: saves made in <em>2.3</em> load again</li>
<li>New: the <a href="/docs/config">configuration guide</a></li>
</ul>
<p>To keep the old save format, add this line to <code>settings.xml</code>:</p>
<pre><code>&lt;option name="legacy-saves" value="true"/&gt;</code></pre>
Output
[b]Version 2.4.1[/b] fixes the save-game crash & adds a config guide.

[list]
[*]Fixed: saves made in [i]2.3[/i] load again
[*]New: the [url=/docs/config]configuration guide[/url]
[/list]

To keep the old save format, add this line to [code]settings.xml[/code]:

[code]<option name="legacy-saves" value="true"/>[/code]

The strong, em, link and list elements each became their BBCode counterpart, and both the inline code element and the pre block became [code], because the converter has a single code tag for both. The list came out in the shape forum help pages show, with [list] and [/list] on lines of their own and one [*] line per item, and a blank line sets it apart from the paragraphs on either side, as the spacing between those blocks did on the web page. The line most worth checking is the XML. Tags are stripped before entities are decoded, so the escaped option element passed through the stripping as plain text and only then turned into the literal line a reader should paste, in the same way that &amp; in the first line became a plain ampersand.

The edge case that catches people

The link came out as [url=/docs/config], exactly as it was written in the HTML, and that path only works on the site it came from. A relative reference is resolved against the address of the page it appears on, so once the announcement is posted, a reader who clicks it, if the forum renders it as a link at all, is sent to /docs/config on the forum's own domain rather than the project's. The converter sees only the fragment you paste, not the page it came from, so it has no base address to resolve the path against, and an image with a relative src is copied into [img] the same way. Make every link and image address absolute before converting and it carries through unchanged.

When not to use this tool

It is the wrong tool for HTML whose formatting lives in CSS rather than in elements. The converter recognises a fixed set of tags and reduces everything else to its text, so a span styled as bold comes out as plain words, a table becomes rows of plain text with its cells separated by bars, and nothing in the output marks where formatting was lost. A whole saved web page converts badly for the same reason, because its navigation, sidebar and footer survive as loose text around the article. Copy only the article's own markup, and if the forum also accepts Markdown or pasted rich text, try that route as well, since it may keep formatting that this short list of tags drops.

Frequently Asked Questions

What is BBCode and why does it still exist?
A markup language for forums, using square brackets — [b]bold[/b] — designed so users could format posts without the software accepting raw HTML. That is still its purpose: a fixed, safe tag vocabulary with no way to inject script or break the page layout.
Which HTML elements map cleanly?
strong/b, em/i, u, a, img, blockquote, code/pre, and ul/ol/li. Those cover the vocabulary most forums implement. Anything structural — divs, spans with classes — has no counterpart and is reduced to its text, and a table becomes one line of text per row.
Is BBCode standardised?
No, and that is the practical difficulty. phpBB, vBulletin, XenForo and Discourse each support a slightly different tag set, so [size], [color] and [table] may or may not work. The core dozen tags are safe everywhere; anything beyond them needs checking.
What happens to CSS styling?
It is lost. BBCode has no stylesheet concept, so this converter reduces a <span style="color:red"> to its text. Many forums accept [color=red], which you can add back by hand where yours does. That is by design — the forum controls presentation, which is why BBCode outlived allowing HTML.
Why not just allow HTML in a forum?
Because it is an XSS vector and a layout hazard in one. Sanitising HTML safely is genuinely hard and has to be maintained against new attacks; a closed BBCode vocabulary is safe by construction, which is why it survived long after HTML became universal.
Why did the line breaks in my HTML disappear?
Because a browser ignores them too. In HTML a newline in the source is only a space; just <br> and block elements such as <p>, <li> and <div> start a new line. The converter follows the same rule, so a paragraph wrapped across several lines in an editor stays one line in the post, as it looked on the page.
What happens to a table?
Most forums have no table tag, so each row becomes a line of text with its cells separated by |, and header cells are made bold. That reads correctly on any forum. If yours supports [table], [tr] and [td], the lines are a quick base to rebuild the table from by hand.

Common errors and gotchas

  • Expecting every HTML element to have a BBCode equivalent, since most do not.
  • Assuming one BBCode dialect, when tag sets vary by forum software.
  • Losing nested structure, where BBCode parsers handle depth inconsistently.
  • Leaving raw HTML behind, which a forum will usually escape and show as text.
  • Converting tables, which most BBCode implementations do not support at all.

Related Converters tools

Private & free — this tool runs entirely in your browser.

IndieKit — Ship your Next.js startup in days.affiliate