BBCode to String Converter
Convert BBCode markup to plain text instantly. Strips all BBCode tags, preserves content structure, and outputs clean readable text.
About
BBCode (Bulletin Board Code) is a lightweight markup language used across forums, message boards, and legacy CMS platforms. When migrating content, extracting quotes, or preparing text for systems that reject markup, manual tag removal introduces errors. Missed closing tags, malformed nesting like [b][i]text[/b][/i], and attribute-bearing tags such as [url=...] or [color=#hex] make simple find-and-replace insufficient. This converter applies iterative regex passes to strip all recognized BBCode tags while preserving the human-readable content and structural line breaks.
The parser handles 30+ standard BBCode tag families including nested constructs. It normalizes whitespace artifacts left by removed tags without collapsing intentional paragraph breaks. Note: this tool approximates visual formatting loss. Content inside [img] tags retains the URL as text. Content inside [url=link]label[/url] preserves the label and appends the link in parentheses for reference retention.
Formulas
The conversion algorithm applies a deterministic sequence of regex-based transformations. Each BBCode tag family is matched by a pattern and replaced with its content extraction rule.
parse(input) → output
Step 1: input → replaceAttributed(input) - Process tags with attributes: [tag=attr]content[/tag] → contextual extraction
Step 2: result → replaceSimple(result) - Process simple tags: [tag]content[/tag] → content
Step 3: result → replaceSelfClosing(result) - Process self-closing: [hr] → ---, [*] → •
Step 4: iterate Steps 1−3 until no tags remain (max 10 passes for nested structures)
Step 5: result → normalize(result) - Collapse > 2 consecutive newlines, trim leading/trailing whitespace per line
where input = raw BBCode string, output = plain text with structural whitespace preserved. The regex pattern for attributed tags follows: \[tag=([^\]*)\]([\s\S]*?)\[\/tag\] with case-insensitive matching.
Reference Data
| BBCode Tag | Syntax | Purpose | Conversion Output |
|---|---|---|---|
| [b] | [b]text[/b] | Bold text | text |
| [i] | [i]text[/i] | Italic text | text |
| [u] | [u]text[/u] | Underline text | text |
| [s] | [s]text[/s] | Strikethrough | text |
| [url] | [url]link[/url] | Simple hyperlink | link |
| [url=] | [url=link]label[/url] | Labeled hyperlink | label (link) |
| [img] | [img]src[/img] | Embed image | src |
| [quote] | [quote]text[/quote] | Blockquote | text |
| [quote=] | [quote=author]text[/quote] | Attributed quote | author said: text |
| [code] | [code]text[/code] | Code block | text |
| [color] | [color=#hex]text[/color] | Text color | text |
| [size] | [size=14]text[/size] | Font size | text |
| [font] | [font=Arial]text[/font] | Font family | text |
| [list] | [list][*]item[/list] | Unordered list | • item |
| [list=1] | [list=1][*]item[/list] | Ordered list | 1. item |
| [*] | [*]item | List item | • item |
| [center] | [center]text[/center] | Center align | text |
| [right] | [right]text[/right] | Right align | text |
| [left] | [left]text[/left] | Left align | text |
| [align] | [align=center]text[/align] | Alignment | text |
| [indent] | [indent]text[/indent] | Indentation | text |
| [table] | [table][tr][td]...[/td][/tr][/table] | Table | cell content separated |
| [tr] | [tr]...[/tr] | Table row | newline |
| [td] | [td]text[/td] | Table cell | text (tab-separated) |
| [th] | [th]text[/th] | Table header | text (tab-separated) |
| [hr] | [hr] | Horizontal rule | --- |
| [spoiler] | [spoiler]text[/spoiler] | Spoiler block | text |
| [spoiler=] | [spoiler=title]text[/spoiler] | Titled spoiler | title: text |
| [email] | [email]addr[/email] | Email link | addr |
| [youtube] | [youtube]id[/youtube] | YouTube embed | https://youtu.be/id |
| [media] | [media]url[/media] | Media embed | url |
| [sup] | [sup]text[/sup] | Superscript | text |
| [sub] | [sub]text[/sub] | Subscript | text |