I can usually get things pretty clean with straight kerosene (the basis of WD40) and a toothbrush. I can buy kerosene in bulk at my local gas station, so it is quite cheap for me.
Carb cleaner, or Berryman's solvent, that you can get in auto parts stores, takes cleaning to the next level, but be sure to use as directed.
Cleaning a freewheel is much more efficient and effective if you dismantle it first, as illustrated by Bob. And scraping the heavy crud first will save time, effort, and cleaning media in the long run, as mentioned by dddd.