BBCode to Text Converter
Convert BBCode markup to clean plain text instantly. Strips formatting tags, extracts URLs, and normalizes whitespace for forums and CMS content.
About
BBCode (Bulletin Board Code) is a lightweight markup language used by most forum platforms - phpBB, vBulletin, SMF, XenForo - to allow users to format posts without raw HTML access. When migrating content between systems, archiving threads, or extracting readable text for indexing, raw BBCode becomes noise. Tags like [b], [url=...], and nested [quote] blocks obscure the actual content. This converter applies a multi-pass regex stripping engine that processes tags in dependency order: nested structures first, then inline formatting, then orphaned brackets. It preserves semantic content - URLs from link tags, alt-text structure from images, bullet items from lists - while discarding all markup syntax.
The parser handles edge cases that naive regex fails on: mismatched tags, nested quotes of arbitrary depth, malformed [color=...] attributes, and mixed-case tag names. Note: this tool approximates visual intent. BBCode that relies on CSS rendering (font size, color) loses that context in plain text. For content exceeding 500 KB, consider splitting input to avoid memory pressure in the browser tab.
Formulas
The converter applies a deterministic multi-pass regex pipeline. Each pass targets a specific tag category, processed in strict order to handle nesting correctly.
Pass 1: Nested structures → [quote], [list] (processed inside-out via greedy innermost match)
Pass 2: Semantic tags → [url=href]label[/url] → label (href)
Pass 3: Media tags → [img], [youtube] → descriptive plain text with URL
Pass 4: Inline formatting → [b], [i], [u], [s], [color], [size], [font] → content only
Pass 5: Cleanup → strip remaining [tag] patterns via regex: \[\/?[a-zA-Z*]+(?:=[^\]]*)?\]
Pass 6: Normalize whitespace → collapse 3+ newlines to 2, trim leading/trailing space
Where href = the URL attribute value extracted via capture group, label = the inner text content of the tag, and all regex flags include gi (global, case-insensitive) to handle mixed-case BBCode variants like [B] or [URL].
Reference Data
| BBCode Tag | Syntax | Plain Text Output | Notes |
|---|---|---|---|
| Bold | [b]text[/b] | text | Formatting stripped entirely |
| Italic | [i]text[/i] | text | Formatting stripped entirely |
| Underline | [u]text[/u] | text | Formatting stripped entirely |
| Strikethrough | [s]text[/s] | text | Formatting stripped entirely |
| URL (labeled) | [url=http://x.com]Link[/url] | Link (http://x.com) | URL extracted and appended in parentheses |
| URL (bare) | [url]http://x.com[/url] | http://x.com | URL preserved as-is |
| Image | [img]http://x.com/pic.jpg[/img] | [Image: http://x.com/pic.jpg] | URL preserved with marker prefix |
| Quote (attributed) | [quote="User"]text[/quote] | Quote (User): text | Author extracted, content indented logically |
| Quote (bare) | [quote]text[/quote] | Quote: text | Generic prefix applied |
| Code | [code]x = 1[/code] | x = 1 | Content preserved verbatim |
| List (unordered) | [list][*]A[*]B[/list] | • A • B | Each item gets bullet prefix |
| List (ordered) | [list=1][*]A[*]B[/list] | 1. A 2. B | Sequential numbering applied |
| Color | [color=red]text[/color] | text | Color attribute discarded |
| Size | [size=18]text[/size] | text | Size attribute discarded |
| Font | [font=Arial]text[/font] | text | Font attribute discarded |
| Align | [center]text[/center] | text | Alignment tags stripped |
| Spoiler | [spoiler]text[/spoiler] | [Spoiler: text] | Content preserved with marker |
| [email][email protected][/email] | [email protected] | Address preserved as-is | |
| YouTube | [youtube]dQw4[/youtube] | [Video: https://youtu.be/dQw4] | ID expanded to short URL |
| Table | [table][tr][td]A[/td][/tr][/table] | A | Structure stripped, content preserved |
| Horizontal Rule | [hr] | --- | Converted to text separator |