For a series of biologically relevant anions we present free energy change upon replacing potassium with sodium in a contact ion pair. Calculations performed using a combination of molecular dynamics simulations and ab initio methods demonstrate the ordering of anions in a Hofmeister series. Small anionic groups such as carboxylates preferentially pair with sodium, while intermediate cases like chloride or monovalent phosphate exhibit almost no specificity and large anions (e.g., methylsulfonate) prefer potassium. These results can rationalize different behavior of Na+ vs K+ at the surface of hydrated proteins, DNA, and reversed micelles.