Due to double-layer forces a charged colloid suspended in an electrolyte is repelled from a like-charged planar wall. We demonstrate that and how a precise measurement of these double-layer forces acting on a colloid near a glass surface can be used to determine surface charge densities. The effective wall-colloid potentials are measured using the total internal reflection microscopy technique, and a whole series of such potentials, taken for various different salt concentrations, are then analyzed in terms of a given theoretical interaction potential, where the surface charge densities are the only unknown parameters. We find reasonable values for the surface charge densities of silica and polystyrene spheres in water, and compare the proposed method with other more established techniques to measure surface charge densities on single particles.