The Perl code behind this page was adapted from http://www.garyshood.com/htmltobb/.
The modified source is here.
(I changed it to handle a few things a little better, mostly paragraph breaks and newlines.)
This is a form that will convert basic HTML into BB code that is used on various forums. It will strip out most HTML that cannot be converted.