Industry guru Dave Taylor offers tech support on technical and business topics, including iPhone, iPod, Microsoft Windows, Sony PSP, cellphones, online advertising, CSS, Web design, business, Unix, Linux, SEO, Mac OS X, and shell script programming.     


What is BBCode and how do I use it?

Dave, I read your HTML primer for bloggers, but I'm confused because on the sites I add comments, I have to use something called bbcode, not HTML. What is bbcode and how do I use it?

Dave's Answer:

I haven't seen many weblogs that require BBCode, I have to say, but there are lots of discussion boards that require postings be written in BBCode rather than HTML. The main reason, as far as I can tell, is so there's some control over people not adding unauthorized HTML sequences (like including pictures from unaffiliated Web sites) because it doesn't seem that much easier than HTML when you look at the two.

Be that as it may, there are now a lot of different sites that are BBCode enabled, so let's have a look at how it works...

The basic difference between BBCode and HTML is that while HTML uses < and > to surround tags, BBCode requires that you use [ and ]. Once you realize that, it's pretty smooth sailing.

For example, bold text is produced with [b]text to have in bold[/b], while italics is generated with [i] and [/i] and underlining (which is still a bad idea on a Web page, even in BBCode) is done with [u] and [/u].

Font color and size changes are accomplished with deprecated HTML "font" tag attributes: [color=red]text in red[/color] turns some text red, for example. You can also specify the hexidecimal color equivalent if you're a purist (that is, use [color=#ccff00]), and text size can be specified as a value of 1..29, where [size=1]1=very small text[/size] and [size=29]29=really big text[/size]. The more modern way to specify these type attributes in the HTML world is to use CSS styles, but that's another story. :-)

A surprising number of boards that use BBCode also support special code listing blocks denoted with [code] and [/code]. Within these two tags, all < and > symbols are translated into their displayable equivalent (the HTML character entities &lt; and &gt;) so that you can share HTML code with other board members.

On sites that allow links to be created, there are two ways you can produce a hypertext reference in BBCode. The easiest is to tell the system that you're entering a Web site address -- a URL -- and that you want it clickable. To point to this Web site, for example, you'd use this: [url]http://www.askdavetaylor.com/[/url]. If you want to get a bit more fancy and have a few words that are clickable, then you need to separate the clickable words from the URL of the target site, as with regular HTML. To have the words "Dave Knows" link to this site, use this: [url=http://www.askdavetaylor.com/]Dave Knows[/url].

Finally, a small number of sites will let you include images using the [img] tag. It's completely analogous to the simpler of the URL forms shown earlier, and linking to, say, the cheery Yahoo Instant Messenger graphic on their home page can be accomplished with: [img]http://us.i1.yimg.com/us.yimg.com/i/ww/bt1/msg.gif[/img]. By the way, just because you can include a graphic doesn't mean you should or are allowed to...

That's about it for the BBCode language. You can combine multiple tags in a sequence if you want blue, bold, URLs, for example (you'd use [color=blue][b][url]the URL[/url][/b][/color]). Just make sure that you always close links from innermost to outermost, just like parentheses in your writing!

Hope that helps you figure out how to use BBCode to its fullest!


Related HTML, JavaScript and Web Site Programming articles:
✔   How to Create Predefined Google Image Search Links?
Thanks for the Amazon URL [see Creating Amazon Search Links]. That worked beautifully. In fact, I sent you $5.00 for coffee in thanks....
✔   Can I embed a Facebook search box on my blog site?
I've seen your articles about how to add a Twitter or Google search box on a Web page, but I have a tougher...
✔   Can I use CSS for drop shadows on my blog?
I want to give my site a bit of a facelift and add some neat graphical elements. One of which is drop shadows....
✔   How can I embed interactive photo panoramas on my site/blog?
I read through your blog entry about how to take panoramic photos with iOS 6 and an iPhone 5 and got enthused. I've...
✔   How can I create a Twitter search URL shortcut?
I'd like to add a few Twitter search links to my Web site. Is that possible, or does Twitter prohibit this sort of...

Let's stay in touch!
Sign up for my weekly AskDaveTaylor Newsletter and you'll receive even more tech and gadget help right to your inbox, along with exclusive news and industry updates. It's good stuff. I promise!
    Enter your name: and your email addr:  









Reader Comments To Date: 14

ariel said, on May 13, 2007 8:54 PM:

but what about video from youtube?

Carl Nelson said, on June 28, 2007 11:04 PM:

Dear Dave,
The BBCODe for posting YouTube and Google Videos does not work on the forums I frequent.

I can post YouTube videos by using the following format:

[flash width=425 height=350]http://www.youtube.com/v/KaZLgEnka8w[/flash]

but this does not work for GoogleVideo or LiveVideo.

Do you know what WILL work for those?

Thanks,

Carl Nelson

craig said, on November 26, 2007 8:56 PM:

Hello Dave. Thanks for the description on BBCode.

I was wondering if you could answer another question on this...

How do you set up the page to use this code? In other words, what do you need to put on the page in addition to the tags?

I don't know anything about programming, except that with html you put at the top and at the bottom, with the tags and content in between. Is there anything equivalent to that tag at the top and bottom in BBCode?

I am trying to post a message to a site that requires BBCode, but when I use the BBCode tags, it doesn't work. Nothing works, and I just get this text all bunched together, and I can't figure out how to use the code so I can have line breaks etc.

Any advice would be welcomed.

charlotte said, on June 3, 2008 10:13 AM:

how do i get symbols with this code?

Corrina Y said, on July 13, 2009 5:01 PM:

Thank you so much for this. I just made an account on Gaia Online and it required this BBCode and I was really confused as to what it was. I'm so used to HTML that this was just a different language... Now that I see the similarity, I just feel stupid haha.
Thanks again!
-Corrina

Eduardp said, on July 27, 2009 12:26 PM:

[b][color=red]it wasn´t all but it was enough ![/b][/color]
thanks
[b]God[/b]bless you

Gucci said, on January 2, 2010 10:15 AM:

hi dave,
i have one doubt, can i change the font using bbcode. here i am not talking about changing the size instead i would like to change the font style.

hope you understood what my doubt was...

please help... thanks..

Faraz Nizamani said, on March 5, 2011 9:48 PM:

Thank you for your kind information...

Dan said, on March 21, 2011 10:10 AM:

Great information about writing bb code. I did not know how to change the colors or bold or anything. Then after reading this page I was like, oh bold it the same way you would HTML, duh! lol Thanks so much for this information, I bookmarked your page!

Marlin said, on June 13, 2011 8:58 PM:

Can I adjust the left/right margins of my post in BBCode? If so how is this done?
Regards

Robert Perez said, on August 13, 2011 7:10 PM:

I was going nuts trying to figure out how to put a banner on my signature in a forum. Thanks for info.

Jay said, on October 7, 2011 10:05 AM:

Thanks you for taking the time to post this. It took care of my issue. Thanks.

Jay

Sonis said, on February 11, 2012 7:04 AM:

[color=blue] thanks @dave it really works[/color]

Paul Dianov said, on February 26, 2012 12:03 PM:

A great tutorial how to use BBcodes for newbies. I am sure that this article will help a lot of people understand the basics on BBcodes. Congrats for the great post and please keep writing interesting articles. Thank you :)

Starbucks coffee cup I do have a lot to say, and questions of my own for that matter, but first I'd like to say thank you, Dave, for all your helpful information by buying you a cup of coffee!

I do have a comment, now that you mention it!











I will never send you any unsolicited email. Ever.






Check This Out Too...

 
Look for Answers
Need Help? Ask Dave Taylor!


Follow Me on Pinterest

Find Me on Google+
ADT on G+
© 2002 - 2013 by Dave Taylor. All Rights Reserved.

Note: This web site is for the purpose of disseminating information for educational purposes, free of charge, for the benefit of all visitors. We take great care to provide quality information. However, we do not guarantee, and accept no legal liability whatsoever arising from or connected to, the accuracy, reliability, currency or completeness of any material contained on this web site or on any linked site. Further, please note that by submitting a question or comment you're agreeing to my terms of service, which are: you relinquish any subsequent rights of ownership to your material by submitting it on this site. My lawyer says "Thanks".
"Ask Dave Taylor®" is a registered trademark of Intuitive Systems, LLC.