Cool HTML to BBCode Converter

v. 1.32

Paste HTML code in textbox and press the button and all the code that can be converted to BBCode will be displayed. HTML code that cannot be converted will be removed. You can also select the options below to convert to vB Code, SMF (Simple Machines Forum) Code, or IPB (Invision Power Board) Code.

BBCode vB Code SMF Code IPB Code

BBCode is code used on message boards powered by software like phpBB. vB Code is code used on message boards powered by software like vBulletin. SMF Bulletin Board Code is used on forums powered by software such as SMF (Simple Machines Forum). IPB Code is used on forums powered by Invision Power Board.

If you are using a popular message board and would like to see its code incorporated into this converter then please email me at: jeffsbaker@sbcglobal.net. Also if you are using some HTML tags and you think they should be converted to a specific bulletin board code tag let me know.

Known Issues and Bugs

6/13/06 - SMF Code - Converting insert of Flash video

When converting HTML flash video code into SMF flash video code the converter looks for HTML code that follows this pattern:

<object width="320" height="240">
<param name="movie" value="flash.swf">
<embed src="flash.swf" width="320" height="240">
</embed>
</object>

The object tag and the param tag are for Netscape compatibility. The embed tag is for Internet Explorer. You should always use both methods when inserting a flash file into an HTML document. This converter uses the object tag and the param tag to convert into SMF code. The converter will just strip out the embed tag.

6/16/06 - <TEXTAREA></TEXTAREA> fix

Previously the code in a TEXTAREA was also converted to bbcode. But now the converter leaves the code in a TEXTAREA unchanged. So you can show people HTML, PHP, Javascript, etc. code in your message. The <TEXTAREA></TEXTAREA> tags are changed to [code][/code] or if you are using vB Code you can select an option to change them to [php][/php], [code][/code], or [html][/html] for proper syntax highlighting.

6/17/06 - SMF does not have ordered list support

I just found out that SMF does not have a tag for ordered lists. So now the HTML tag <OL> is converted to [list] instead of [list=1] when SMF Code is selected.

6/17/06 - SMF Code - Added <ABBR> and <ACRONYM>

Added a conversion for HTML tags <ABBR></ABBR> and <ACRONYM></ACRONYM> to SMF tags [acronym][/acronym].

6/18/06 - Netscape Fix

Cool HTML to BBCode Converter now works with Netscape 6.0 and above. It has not been tested with Netscape versions below 6.0.

6/18/06 - Added Copy to Clipboard Button

For Internet Explorer 4.0 and above there is now a button that copies all the converted code in the textbox to the clipboard for easy pasting. If you are using Firefox or Netscape a button for selecting all the text appears and then you can press CTRL-C to copy.

6/20/06 - Support for IPB Code

We have now added an option to convert IPB (Invision Power Board) BBCode. Along with that, if you select IPB Code, then you are given options to change <TEXTAREA></TEXTAREA> tags to [sql][/sql], [code][/code], or [html][/html] for proper syntax highlighting.

6/27/06 - Fixed <PRE> and <UL> bug

Fixed a bug where <PRE> was not being converted to [code] or [pre] depending on settings because the <P ...> conversion was replacing them with carriage returns. Also fixed a bug where <UL> was not being converted to [list].

6/27/06 - SMF Code - Added <TH> conversion

Cool HTML2BBCode Converter now converts <TH> and </TH> tags into [td] and [/td] tags if you have SMF Code selected.

6/27/06 - Added <SCRIPT></SCRIPT> conversion

<SCRIPT> tags are now converted the same way that <TEXTAREA> tags are converted, into [code][/code] tags. Or if you select vB code or IPB code there are other options.

6/27/06 - <TR><TD><TH> conversion

If you are not using SMF code then Cool HTML2BBCode Converter now converts <TR><TD> and <TH> tags into a carriage return, a space and a space, respectively. This is so that TABLEs look a little better when converted to bbcode. If you are using SMF code then they are converted into SMF tables.

9/1/06 - Fixed <IMG ALT= > Problem

Fixed problem where the ALT portion of an IMG tag messed up the conversion if it preceded the SRC parameter. Thanks rickdog.

10/9/06 - Bug Fix - Color and Size

If you had the word "color" or "size" in your text the converter would convert it to ][color or ][size. It should now only make those changes if they are part of a font statement. Thanks Bo.

10/27/06 - Bug Fix - Image in Anchor Tag

Previously if you put an image as the link for an anchor tag then the converter would think that the reference to the image was actually an image tag and it would append [/img] to the end of the tag. Ex: <A HREF="image.jpg">Click here to see image</A> was converted to [url=image.jpg[/img]]Click here to see image[/url]. This has been fixed. Now it is converted correctly to: [url=image.jpg]Click here to see image[/url].

10/28/06 - Major Bug Fix - Quotes and Single Quote

Previously if you used a single quote (') to surround your variables instead of double quotes (") then the converter would sometimes remove more code then it was supposed to because it was trying to remove the double quote variables first. This only happened with FONT FACE and when removing tag paramaters such as BORDER, STYLE, NAME, ID, TARGET, CLASSID, CLASS and ALT. This has been fixed. Please let me know if there are any other tag paramaters that should be removed.

1/9/08 - Now removing TITLE Tag paramater

Thank you to F. Martin for pointing out that this converter was not removing TITLE.

1/13/08 - <STRONG> tag converstion.

The converter now converts <STRONG> and </STRONG> to [b] and [/b] if you select bbcode or IPB code.

4/12/09 - SMF Code - PHP Tag

SMF Code has a [php] tag that color formats PHP syntax. So now when you select SMF Code you can select to convert TEXTAREA or SCRIPT tags to [code] or [php].

4/12/09 - IPB Code - Many new tags for IPB

I have added many new tags for IPB. These include a conversion of <HR> to [hr], <SUB></SUB> to [sub][/sub] and <SUP></SUP> to [sup][/sup]. Also you now have the option to convert <TEXTAREA></TEXTAREA> and <SCRIPT></SCRIPT> tags to [php][/php] or [xml][/xml] as well as [code][/code], [sql][/sql] or [html][/html] for proper syntax highlighting.

5/29/09 - Switched FONT closing Tag

Now <FONT face="arial" color="blue">blue</font> becomes [font=arial][color=blue]blue[/color][/font] instead of [font=arial][color=blue]blue[/font][/color]

7/20/09 - IPB Code - Converting insert of Flash video

When converting HTML flash video code into IPB flash video code the converter looks for HTML code that follows this pattern:

<object width="320" height="240">
<param name="movie" value="flash.swf">
<embed src="flash.swf" width="320" height="240">
</embed>
</object>

12/31/09 - SMF Code - <STRONG> tag

Previously, the tag <STRONG> was converted to [glow] for simple machine forums. But now it is converted to [B][/B].

10/05/11 - ver 1.26 - rel and onclick attributes

rel and onclick attributes are now removed from HTML tags.

10/05/11 - ver 1.3 - Whitespace including newlines

The converter was not removing attributes such as onclick,rel,class,alt if they were on a new line. That has been fixed. For example, previously for the statement:

<a href="www.sample.com"
onclick="javascript">
the onclick would not be removed because it was on a newline. Now it will be removed.

4/2/2012 - ver 1.31 - Removing ID and NAME and BORDER etc

Previously the converter was removing any id= border= or name= anywhere in the text. But now it has been changed to only remove those if there is whitepace in front of it. This helps for if there is a URL with id= or name= in it. Such as: <a href="test.php?id=1234">
Instead of removing the id=1234, it will now keep it. But it will still remove the id attribute in an html tag.

7/16/2012 - ver 1.32 - EM, header tags and &nbsp;

Now EM tags are converted to [i] bbcode tags and H1 to H6 header tags are converted to [b] bbcode tags. Also &nbsp; HTML entity is now converted to a space. Thanks to PawelW.

Conversion Process

Any HTML tags that are not listed in the table below are stripped out of the text. HTML tags listed below are converted to the equivalent BBCode, vB Code, or SMF Code, depending on your settings.

This table shows how each tag is converted:
HTML Tag Converts to:
[-]
bb
[-]
vB
[-]
smf
[-]
ibp
BBCodevB CodeSMF CodeIPB Code
<BR> or <BR />Carriage ReturnCarriage ReturnCarriage ReturnCarriage Return
<P>2 Carriage Returns2 Carriage Returns2 Carriage Returns2 Carriage Returns
<H1> to <H6>2 Carriage Returns[b]2 Carriage Returns[b]2 Carriage Returns[b]2 Carriage Returns[b]
<BLOCKQUOTE></BLOCKQUOTE>[quote][/quote][quote][/quote][quote][/quote][quote][/quote]
<UL></UL>[list][/list][list][/list][list][/list][list][/list]
<OL></OL>[list=1][/list][list=1][/list][list][/list][list=1][/list]
<LI>[*][*][*][*]
<IMG SRC="pic.jpg">[img]pic.jpg[/img][img]pic.jpg[/img][img]pic.jpg[/img][img]pic.jpg[/img]
<A HREF="http://webpage.com/">Web Page</A>[url=http://webpage.com]Web Page[/url][url=http://webpage.com]Web Page[/url][url=http://webpage.com]Web Page[/url][url=http://webpage.com]Web Page[/url]
<A HREF="mailto:me@address.com">Email me</A>me@address.com[email=me@addres.com]Email me[/email][email=me@addres.com]Email me[/email][email=me@addres.com]Email me[/email]
<BIG></BIG>[b][/b][b][/b][b][/b][b][/b]
<B></B>[b][/b][b][/b][b][/b][b][/b]
<U></U>[u][/u][u][/u][u][/u][u][/u]
<I></I> or <EM></EM>[i][/i][i][/i][i][/i][i][/i]
<FONT FACE="arial"></FONT>
[font=arial][/font][font=arial][/font][font=arial][/font]
<FONT COLOR="red"></FONT>[color=red][/color][color=red][/color][color=red][/color][color=red][/color]
<FONT SIZE="5"></FONT>[size=5][/size][size=5][/size][size=5][/size][size=5][/size]
<FONT FACE="arial" COLOR="red" SIZE="5"></FONT>[color=blue][size=5]
[/color][/size]
[font=arial][color=red][size=5]
[/font][/color][/size]
[font=arial][color=red][size=5]
[/font][/color][/size]
[font=arial][color=red][size=5]
[/font][/color][/size]
<STRONG></STRONG>[b][/b][highlight][/highlight][b][/b][b][/b]
<TEXTAREA></TEXTAREA>
(Note: All code within textarea is not converted.)
[code][/code][code][/code]
or [html][/html]
or [php][/php]
[code][/code]
or [php][/php]
[code][/code]
or [html][/html]
or [php][/php]
or [xml][/xml]
or [sql][/sql]
<SCRIPT></SCRIPT>
(Note: All code within script is not converted.)
[code][/code][code][/code]
or [html][/html]
or [php][/php]
[code][/code]
or [php][/php]
[code][/code]
or [html][/html]
or [php][/php]
or [xml][/xml]
or [sql][/sql]
<PRE></PRE>[code][/code][code][/code][pre][/pre][code][/code]
<LEFT></LEFT>
[left][/left][left][/left][left][/left]
<CENTER></CENTER>
[center][/center][center][/center][center][/center]
<RIGHT></RIGHT>
[right][/right][right][/right][right][/right]
<STRIKE></STRIKE>

[s][/s][s][/s]
<MARQUEE></MARQUEE>

[move][/move]
<HR>

[hr][hr]
<object width="320" height="240">
<param name="movie" value="flash.swf">
<embed src="flash.swf" width="320" height="240">
</embed>
</object>


[flash=320,240]flash.swf[/flash][flash=320,240]flash.swf[/flash]
<TABLE></TABLE>

[table][/table]
(Note: It seems that SMF cannot handle nested tables.)

<TR></TR>Carriage ReturnCarriage Return[tr][/tr]Carriage Return
<TD></TD>(Space)(Space)[td][/td](Space)
<TH></TH>(Space)(Space)[td][/td](Space)
&nbsp;(Space)(Space)(Space)(Space)
<SUP></SUP>

[sup][/sup][sup][/sup]
<SUB></SUB>

[sub][/sub][sub][/sub]
<TT></TT>

[tt][/tt]
<ABBR TITLE="World Wide Web">WWW</ABBR>

[acronym=World Wide Web]WWW[/acronym]
<ACRONYM TITLE="World Wide Web">WWW</ACRONYM>

[acronym=World Wide Web]WWW[/acronym]