BB Code is a common way for format blog posts, forum posts, and comments on those posts. BB Code is an acronym for bulletin board code. If you are familiar with HTML code then BB Code will be very easy for you to understand. If not then need not worry, we will be covering all of the essential info you'll need to know.

BB Code is an alternative to using HTML in user input forms. BB Code is a "safer" alternative to HTML, for when you have unknown users making posts on your site and you want to protect from the users trying to do anything malicious. Ultimately the BB Code, is converted into normal html, usually by a php script, so that the browser can interpret it.

Like HTML, BB Code has tags or key words or characters placed within a tag that contain a special meaning. Example:

<b> bold text [b]bold text[/b]
<i> italic text [i]italic text[/i]
<u> underline text [u]underlined text[/u]
text-decoration:line-through; strikethrough text [s]line-through text[/s]
font-size:value; some text [size={number}]text[/size]
color; some text [color={color}]text[/color]
text-align:center; some text [center]centered text[/center]

some text

<a href="url"> this is a link [url={url}]link title here[/url]
<img src="img" /> {image} [img]{url}[/img]

<img src="img" height="#" width="#" />

Resized Image


<ul> unordered list [ul][li]{text}[/li]...[/ul]
<ol> ordered list [ol][li]{text}[/li]...[/ol]
<code> monospace text
<table><tr><td></td></tr></table> [table][tr][td][/td][/tr][/table]

For those that know HTML you see the similarities. For those you who are not, we can see how certain words or characters are encased in brackets [] and they have a special meaning. An alternative to BB Code is a HTML Filter that will not allow javascript and other tags.

Differences between HTML and BB Code

Angled brackets <> Rectangular brackets []
Allows inline CSS by use of the style attribute Does not allow any inline CSS to be used
Chances of executing JavaScript or breaking the layout of a website No chance of executing JavaScript or breaking the layout of the site
Formatting is very picky and cannot be changed Formatting is simple and easy to understand and to change
There is a standard There is not a standard

BB Code is used in many forum softwares and content management systems.