piapia123
en

UBB and HTML Converter

Text

Everything runs locally in your browser — nothing is uploaded

Input
Drop a file here to load its contents
Output

Convert forum code — UBB, the `[b]` `[url]` `[img]` dialect used by Discuz! and its relatives — to HTML, or the other way round. Nesting is the part that matters: `[b]bold[i]italic[/i]still bold[/b]` has to produce correctly nested tags, and a converter built from a chain of find-and-replace cannot do it — only a stack knows which `[i]` a given `[/i]` belongs to, so replacement-based tools emit crossing tags that browsers have to guess at. Three more decisions: unrecognised tags are kept as they are (`[hide]` and `[attach]` are per-forum extensions, and dropping them silently deletes the user formatting), `javascript:` links never become clickable `<a>` tags (the output goes onto a forum — that is an XSS entry point), and `<` and `&` in the body are escaped (otherwise "1 < 2" becomes a malformed tag that skews everything after it).

Features

  • Inline tags: bold, italic, underline, strikethrough, colour, size, font and alignment
  • Both link forms ([url]address[/url] and [url=address]text[/url]), plus email and images
  • Quotes (including [quote=name] attribution), code blocks, and ordered and unordered lists
  • Nesting closed in the correct order — what a find-and-replace converter cannot do
  • Unclosed tags are closed at the end, and stray closing tags are treated as plain text
  • Tag names are case-insensitive: [B] is the same as [b]
  • Sizes map through the Discuz 1–7 scale rather than becoming font-size: 7px
  • Square brackets inside a [code] block are left alone — that is the code itself
  • Unrecognised tags survive untouched, so the user layout does not vanish
  • javascript: links degrade to plain text instead of producing a clickable <a>
  • The HTML → UBB direction covers paragraphs, lists, quotes, code blocks and inline formatting
  • Everything runs locally in the browser; your content is never uploaded

How to use

  1. Paste the forum code or the HTML
  2. The direction usually needs no choosing — a leading < is read as HTML
  3. Turn off the line-break option if you need to
  4. Copy the result

FAQ

Why does nesting need a stack?
Because which `[i]` a given `[/i]` closes is only knowable from the full tag sequence. A converter that runs find-and-replace step by step turns `[b]bold[i]italic[/i]still bold[/b]` into crossing tags (`<strong>bold<em>italic</strong>still bold</em>`), leaving the browser to guess how to repair it. That kind of error raises nothing at all — the page simply looks wrong. So this tool scans once with a stack, pushing and popping, and closes whatever is still open at the end.
What happens to tags it does not recognise?
They are kept exactly as they are — not converted, not removed. `[hide]` (reply to view), `[attach]` (attachments) and `[media]` (video) are per-forum extensions with no equivalent outside Discuz, and the tool has no way to know what they should become. Keeping them means the user can see at a glance that something was not converted; deleting them hands back a post with pieces missing, which nothing on screen reveals.
Why did some links not become links?
Because their scheme is `javascript:`, `data:` or similar. The output is going onto a forum or blog, where a clickable `javascript:` link is an XSS entry point. This tool only lets through http, https, ftp, mailto, tel and similar, keeping the text and emitting no `<a>` for anything else.
How many pixels is [size=5]?
Discuz sizes are a 1–7 scale, not pixel values; treating the number as pixels gives `font-size: 7px`, which is unreadable. These are mapped through the values the Discuz templates actually use: 1→12px, 3→16px (the default), 5→24px, 7→48px. An unrecognised step falls back to 16px.
Should line breaks become br?
The forum convention is that a line break is a line break, so that is the default. Some sites already render with `white-space: pre-wrap`, though, and there an extra `<br>` doubles every blank line. If the spacing looks too wide after pasting, turn the option off.
Is my content uploaded?
No. The conversion happens entirely in browser memory; the page makes no requests and works offline.

Related tools