extractCSS is a JavaScript library and an online tool that lets you extract element ID, class and inline styles from HTML document and output them as CSS stylesheet.
A hosted online version of extract css is available at extractcss.com. All you have to do is to type or paste your HTML document and let the tool to do the rest for you!