by MaDMAx, HTML by Rhodium
Most drugs have an amine group. This is a -NH2 attached to the molecule somewhere. NH3 is a base (accepts protons from acids easily) so the drugs are bases also. Hence the name freebase. When you make the drug, it usually starts out in the freebase form, which is quite often an oil. What happens when you react an acid and a base? You get a salt. So when you take your freebase (base) drug and react it with an acid, you get a salt, such as a hydrochloride salt if you react it with hydrogen chloride (HCl).
Salts are usually crystalline solids rather than oils or waxy solids, which is why they are so popular with drugs, it makes them easier to handle, and the drug properties are not changed. Think about it, you have HCl in your stomach, and acid throughout your body, so if you ingest a drug in either form, it will end up being in the same form (probably a salt) in your body no matter how it started out.
Freebases and salts usually have drastically different properties. An important one is that freebases are usually soluble (will dissolve in) in non-polar solvents such as toluene and hot naphtha, and not soluble in polar solvents such as water. The salts are usually the opposite, soluble in water, but not toluene etc. This is how acid/base extractions (A/B) work.
You can basify your molecule with NaOH (lye) to form the freebase, which is not soluble in water, but it will dissolve in a non polar solvent. So you add your non-polar solvent and the freebase goes in to it (a lot faster if you shake it all up instead of waiting for the freebase to float up to it). Once you have freebase in your non-polar you can wash the non-polar solvent with water to get rid of any non-freebase drug material (such as excess lye). The water will not remove any of your freebase.
Then to recover your hydrochloride salt (the most popular form of most drugs), you react it with hydrochloric acid. Muriatic acid is hydrogen chloride (HCl) dissolved in water. So if you add this to the non-polar with the freebase, the freebase will react with the HCl to form the salt, which is now soluble in water and not in non-polar, so it will dissolve into the water layer, which you can separate and evaporate to obtain your crystals.
Since evaporating water sucks, and quite often leaves behind impurities, it is nice to react your freebase in non-polar with HCl without any water around. This is when gassing comes into play. You can generate pure HCl which is a gas without any water, and bubble this gas through your freebase/non-polar. It will react with your freebase to form the hydrochloride salt (what you want). Since the salt is not soluble in the non-polar, it will them fall out of solution as crystals which can be collected by filtering.
Once you have your dry drug hydrochloride salt crystals, sometimes you want to get them more pure, because impurities can be trapped inside the tiny clumps of crystals. A good way of doing this is to recrystallize. The idea behind this is to find a solvent that the crystals are kind of soluble in and kind of not. Alcohols usually work well for this. When talking about solvents and solid materials, hot solvent dissolves more solid than cold solvent, so this can be used to your advantage. (The case is opposite for gases but I won't go into that).
Get two containers. Put some alcohol in one and bring it up to boiling. Put your crystals in the other container. Slowly add boiling alcohol to your crystals and they will dissolve. Use just enough alcohol to dissolve all of your crystals.
Now since cold alcohol doesn't dissolve crystals very well, cool down the alcohol/product and the crystals will come back out (recrystallize). The slower you cool the alcohol, the bigger the crystals are. The bigger the crystals are, the fewer impurities will be trapped inside of them, and the purer your product will be. So big crystals = pure crystals (usually).
One good way for ensuring that your alcohol cools down nice and slow is to put some water in a pot and heat it to boiling and take it off of the heat. Then put your container with hot alcohol/dissolved crystals in the pot of water being sure not to get any water into the alcohol, cover the container, and let it cool down to room temperature. Then you can put the container with alcohol in the refridgerator to cool more. Then into the freezer to cool more. Then you can filter your pretty crystals out. Now there is usually still a little bit of product left in the alcohol, so if you boil off say 75% of the alcohol and repeat the cooling process you can get some more crystals.
There are other ways of changing the solubility of the crystals in the alcohol, such as adding acetone or ether to the alcohol, but the temperature method works quite well, is cheap, and simple. So newbies should use it first, then experiment with other methods if they want to.