(preface): Go read a introductory chemistry book.
1. Figure out what kind of DXM you have. Polistyrex (Delsym) or HBr (everything else).
2. Do the math to figure out how many moles of DXM freebase you'd expect to see in solution.
DXM freebase has a molar mass of 271.4 G/mol.
HBr has a molar mass of 81.
One equivalent of polistyrex has a molar mass of 184.2.
2a. Figure out the weight of the compound you have.
HBr = 352.4 G/mol
Psx = 455.6 G/mol.
2b. Figure out how many moles of compound you have.
(I'm going to assume you have 354mg HBr)
Well, 352.4 is pretty close to 354, so let's say we have 0.001mol. (1 mmol)
2c. Let's check our work to be sure:
1mmol x 354 g/mol = 354 mg.
3. Take that molarity number. That's the amount of alkali you have to add to react with the hydrobromic acid and freee the freebase.
Double it to be safe, if you're using a weak base like sodium (bi)carbonate. If you're using lye (sodium hydroxide), leave as is.
3a. Figure out how much acid your alkali will neutralize, per mole. 1 mole of sodium carbonate or calcium hydroxide neutralises 2 moles of acid. 1 mol of sodium hydroxide will neutralise one mole acid. Don't use baking soda (sodium bicarbonate), it's not strong enough. Bake it in the oven at 350 deg for a couple hours to convert it to sodium carbonate if you really have to use it.
3b. Figure out the weight of alkali you need. Let's be easy and use sodium hydroxide (lye): we need 1 mmol, so let's work it out:
NaOH = 40g/mol. x 1mmol = 40 mg (!)
Now we have our numbers. We will neutralize 354mg DXM HBr with 40mg lye to yield ~271 mg pure DXM freebase.
4. Dilute yer syrup. Make it look less nasty.
5. Make up some lye solution (dissolve 1g lye in 10ml water, making 100 mg/ml - don't try to add 40mg!) and add about 0.5 - 1ml (50-100mg). You should see DXM flocculate out. If it doesn't add more alkali. If you find yourself adding more than 2-3x, stop and test the pH. It should be around 10-11 to ensure complete freebasing.
The pKa, or where approximately 50% will be freebase and 50% a salt, is around pH 9.2. use pH papers to monitor and keep the pH above 9, preferably above 10.
6. Extract with your non-polar solvent (chlorofrorm, hexanes etc)
7. Extract the non-polar solvent with acidic water. 1% citric acid in water should be great.
The solvent layering will depend on what solvent you use. Chloroform sinks to the bottom of a water layer. Toluene, ethyl acetate, ether, hexanes, etc float on top. Keep this in mind so you don't throw the goodies away.