If you're using Windows (you can skip directly to step 3 if using a recent versions of Calibre; it now supports importing .chm files directly):
Extract the HTML files from the CHM container from the command prompt with HH.EXE
Example:
HH.EXE -decompile C:\Temp\decompile-folder C:\Temp\yourCHM.chm
(Mac users can use Tubby to convert CHM to HTML)
Merge the HTML files into a single file (e.g. with SoftSnow Merger)
Use Calibre to convert it to EPUB.
All programs mentioned above are freeware, and hh.exe is a Microsoft Windows Help utility.
There are commercial programs like ABC Amber CHM Converter that will perform steps 1 & 2 automatically. However, I don't know any software that will convert CHM directly to EPUB. Other commercial applications (for example, Universal Document Converter) can be used to convert CHM to PDF which the Kindle may or may not handle all that well.
I have now experimented with numerous, numerous tools to convert epub to pdf, but none do what I was hoping to accomplish. I have also experimented with numerous e-readers in general, hoping to display my files as I wanted them and then "print" them directly to a software pdf printer. The newest version of calibre's e-book reader allows printing directly to PDF. Unfortunately, those pdfs do not resemble the text as you are viewing it in the e-reader window. Regardless of the font size of the e-reader text, the pdf is built using font sizes specified elsewhere. This would be a suggestion for future releases of calibre to implement: print as-you-see-it from the e-reader window.
Of the various e-readers I used, epubreader extension for firefox is by far the best and most stable (calibre used up all 2GB of my ram before hanging and crashing multiple times). The display settings of epubreader allow great flexibility for displaying the text "as defined by the book settings," although the e-book settings do not always perfectly preserve the exact appearance of the print book. For all of its strengths, however, epubreader does not seem able to print to a pdf or to print from firefox at all. When I contacted support, I was referred to calibre.
As it stands, calibre is still the tool that comes closest to accomplishing my original goals. Hopefully future releases of calibre or epubreader will implement a print-as-you-see it option, allowing their ebook readers to double up as a live "print preview." Until then, I will have to make do with editing the epub raw data with calibre epub editor, and/ or building dozens of pdf books before I find the most acceptable settings for producing a suitable pdf.
Best Answer
Calibre is the way to go for conversion between eReader formats, it's a free cross-platform tools.