Even though I love my butterfly identification books, they don’t have any info about moths and caterpillars. Fortunately, the Web does:
http://bugguide.net This has lots of pictures of all sorts of bugs. You have to browse through the photos (organized by family) and compare the images to your critter. However, the site also has a feature where you can upload a photo and other people can id it. The focus is on the US and Canada. If you think you know what your insect is, you can search for the name and compare your bug to the photos.
http://www.discoverlife.org/mp/20q Has both butterfly and caterpillar ID guides where you select features and it returns some species. Their database is small in these areas (caterpillars- 173 total, butterflies- 795) but considering the site is trying to ID all other living things in the world (including 122 types of slime mold), it is a good start.
http://www.butterfliesandmoths.org Lots of photos. You can also send photos in for identification.