Convert BBCode markup to HTML
Convert BBCode to HTML instantly with our free online BBCode to HTML converter. This tool helps forum administrators and content creators transform BBCode markup into HTML for modern web applications. Simply paste your BBCode and get HTML output in real-time.
BBCode to HTML converter transforms BBCode (Bulletin Board Code) markup into standard HTML. BBCode is a lightweight markup language used in forums, message boards, and community platforms for text formatting without allowing raw HTML.
Parse BBCode tags ([b], [i], [url], [img], etc.), match opening and closing tags, and convert to HTML equivalents. Handle nested tags, attributes, and validate proper tag closure. Sanitize to prevent XSS.
Common BBCode: [b]bold[/b], [i]italic[/i], [u]underline[/u], [url=http://...]link[/url], [img]url[/img], [quote]text[/quote], [code]code[/code], [color=red]text[/color], [size=14]text[/size]. Case-insensitive.
Convert forum posts to HTML.
Migrate vBulletin to modern platformRender BBCode content as HTML.
Show live preview of BBCode input.
Convert BBCode posts to HTML emails.
// BBCode input:
const bbcode = `
[b]Bold text[/b] and [i]italic[/i]
[url=https://example.com]Click here[/url]
[img]https://example.com/image.jpg[/img]
[quote="John"]This is a quote[/quote]
[code]console.log("Hello");[/code]
[list]
[*]Item 1
[*]Item 2
[/list]
[color=red]Red text[/color]
`;
// Simple BBCode parser
function bbcodeToHtml(text) {
const replacements = [
[/\[b\](.*?)\[\/b\]/gi, '<strong>$1</strong>'],
[/\[i\](.*?)\[\/i\]/gi, '<em>$1</em>'],
[/\[u\](.*?)\[\/u\]/gi, '<u>$1</u>'],
[/\[s\](.*?)\[\/s\]/gi, '<s>$1</s>'],
[/\[url=(.*?)\](.*?)\[\/url\]/gi, '<a href="$1">$2</a>'],
[/\[url\](.*?)\[\/url\]/gi, '<a href="$1">$1</a>'],
[/\[img\](.*?)\[\/img\]/gi, '<img src="$1" alt="">'],
[/\[quote="?(.*?)"?\](.*?)\[\/quote\]/gis, '<blockquote><cite>$1</cite>$2</blockquote>'],
[/\[code\](.*?)\[\/code\]/gis, '<pre><code>$1</code></pre>'],
[/\[color=(.*?)\](.*?)\[\/color\]/gi, '<span style="color:$1">$2</span>'],
[/\[size=(.*?)\](.*?)\[\/size\]/gi, '<span style="font-size:$1px">$2</span>'],
[/\[list\](.*?)\[\/list\]/gis, '<ul>$1</ul>'],
[/\[\*\](.*?)(?=\[\*\]|\[\/list\])/gi, '<li>$1</li>'],
];
let html = text;
for (const [pattern, replacement] of replacements) {
html = html.replace(pattern, replacement);
}
return html;
}
// HTML output:
<strong>Bold text</strong> and <em>italic</em>
<a href="https://example.com">Click here</a>
<img src="https://example.com/image.jpg" alt="">
<blockquote><cite>John</cite>This is a quote</blockquote>
<pre><code>console.log("Hello");</code></pre>
<ul><li>Item 1</li><li>Item 2</li></ul>
<span style="color:red">Red text</span>Simple regex-based BBCode parser. Production code should use proper parsing and sanitization.
Use BBCode to HTML converter when migrating forum content, displaying BBCode in modern applications, or building forum/community features.
Only if properly implemented. The converter must sanitize URLs (no javascript:), escape HTML in text, and whitelist allowed tags. Don't trust user BBCode without sanitization.