BBCode Editor - Visual WYSIWYG BBCode Generator
Free online BBCode editor with visual WYSIWYG toolbar. Format text, add links, images, lists, and generate clean BBCode for forums instantly.
About
BBCode (Bulletin Board Code) remains the de facto markup language for web forums, signature blocks, and legacy CMS platforms where HTML is restricted or sanitized. Generating correct BBCode by hand is error-prone: one unclosed [b] tag corrupts the entire post rendering, and nested structures like [quote][list][url] chains fail silently on most parsers. This editor provides a WYSIWYG surface that converts rich formatting into valid, nested BBCode in real time. It handles edge cases such as overlapping tags, empty elements, and whitespace normalization that manual writing consistently gets wrong.
The converter walks the DOM tree of the editor content and maps each HTML node to its BBCode equivalent using a deterministic traversal algorithm. Limitations: the output targets the most common BBCode dialect (phpBB/SMF/vBulletin). Custom tags like [spoiler] or [youtube] are not generated automatically. Paste operations strip unsafe HTML attributes to prevent injection. Pro tip: always preview your BBCode on the target forum before submitting long posts - parser implementations vary between platforms.
Formulas
The editor converts rich HTML from the WYSIWYG surface to BBCode using a recursive DOM tree traversal algorithm. For each node N in the editor's DOM:
The mapping function map uses a lookup table: B → [b], I → [i], A → [url=href], IMG → [img], and so on. Inline styles are parsed for color and font-size properties and mapped to [color=v] and [size=v] respectively. Traversal is depth-first, preserving nesting order.
Where N = DOM node, map = HTML-to-BBCode tag lookup, children = recursive processing of child nodes, escape = text sanitization function that preserves line breaks as newlines.
Reference Data
| BBCode Tag | Syntax | Description | HTML Equivalent | Forum Support |
|---|---|---|---|---|
| Bold | [b]text[/b] | Bold text | <b> | Universal |
| Italic | [i]text[/i] | Italic text | <i> | Universal |
| Underline | [u]text[/u] | Underlined text | <u> | Universal |
| Strikethrough | [s]text[/s] | Strikethrough text | <s> | Most forums |
| URL (Auto) | [url]href[/url] | Link with URL as label | <a href> | Universal |
| URL (Labeled) | [url=href]text[/url] | Link with custom label | <a href> | Universal |
| Image | [img]src[/img] | Embedded image | <img> | Universal |
| Quote | [quote]text[/quote] | Block quotation | <blockquote> | Universal |
| Code | [code]text[/code] | Monospaced code block | <pre><code> | Universal |
| Color | [color=#hex]text[/color] | Colored text | <span style="color"> | Most forums |
| Size | [size=n]text[/size] | Font size (1 - 7 or px) | <span style="font-size"> | Most forums |
| Unordered List | [list][*]item[/list] | Bulleted list | <ul><li> | Universal |
| Ordered List | [list=1][*]item[/list] | Numbered list | <ol><li> | Most forums |
| Align Center | [center]text[/center] | Centered text | <div style="text-align:center"> | Most forums |
| Align Right | [right]text[/right] | Right-aligned text | <div style="text-align:right"> | Some forums |
| Horizontal Rule | [hr] | Horizontal divider | <hr> | Some forums |
| Table | [table][tr][td]cell[/td][/tr][/table] | Data table | <table> | vBulletin, XenForo |
| Spoiler | [spoiler]text[/spoiler] | Collapsible content | Custom JS toggle | XenForo, SMF |
| [email]addr[/email] | Email link | <a href="mailto:"> | Most forums | |
| YouTube | [youtube]id[/youtube] | Embedded video | <iframe> | XenForo, custom |
Frequently Asked Questions
in the editor) produces a double newline in the BBCode output. Shift+Enter creates a single line break (mapped to one newline). Consecutive empty lines are normalized to a maximum of two newlines to prevent excessive whitespace, which most forum renderers collapse anyway.