Charged or neutral — the medium decides
Many drugs carry a group that can gain or lose a proton, making them weak acids or weak bases. Ionization is the act of becoming charged, and how readily a group does this is captured by its pKa — the pH at which exactly half the molecules are ionized and half are neutral. The pKa is a fixed property of the molecule; the surrounding pH is the dial you turn.
Henderson–Hasselbalch: putting numbers on it
The Henderson–Hasselbalch equation turns the qualitative picture into a ratio. It says the log of the ratio of ionized to unionized forms equals the difference between pH and pKa. From it you can compute exactly what fraction of a drug is charged at stomach pH versus blood pH — and since only the neutral form crosses lipid membranes well, that fraction is the heart of the pH-partition hypothesis of absorption.
Henderson-Hasselbalch for a weak acid
pH = pKa + log( [ionized] / [unionized] )
Example: a weak acid, pKa = 4.4
In the stomach (pH 1.4):
log(ratio) = pH - pKa = 1.4 - 4.4 = -3.0
ionized/unionized = 10^-3.0 = 0.001
-> ~0.1% ionized, ~99.9% neutral (absorbs well)
In blood (pH 7.4):
log(ratio) = 7.4 - 4.4 = +3.0
ionized/unionized = 10^3.0 = 1000
-> ~99.9% ionized, ~0.1% neutral (trapped, stays in plasma)Why pH sets solubility — and where salts come in
Here is the lever that makes a formulator's job possible: the charged form of a drug is far more water-soluble than the neutral form. So total solubility is the fixed intrinsic solubility of the neutral form plus whatever extra the ionized form contributes at that pH. Lower the pH for a weak base and solubility soars; raise it past a threshold and the neutral form crashes out as solid. The pH–solubility curve has a sharp elbow at exactly this point.
This is exactly why so many drugs are sold as salts. Salt formation pairs an acidic or basic drug with a counter-ion to give a solid that dissolves readily — think hydrochloride salts of bases or sodium salts of acids. The salt does not change the molecule's intrinsic chemistry, but it can transform its dissolution behaviour and its handling. Remember, though: push the local pH past the elbow and even a salt can precipitate as its free form.