Well there are a lot of factors to consider. Helmets are designed not only to be able to absorb impact from a dead center hit, but it's shape is also a significant factor which helps in deflection. However remember that bullets come in many shapes and forms. For example hollow points, steel jacket, steel cores etc. Think about it. If you're talking about large caliber high velocity ammo with steel tips and core, no helmet will be strong enough against that. Well you could design a helmet to withstand that but it would be VERY heavy. Regardless there are large caliber machine guns that can penetrate thin armored tanks. Also an AK-47 with full metal jacket rounds can penetrate 3/8" steel plate.
As for rail guns. Those are only useful for mounting on artillary. There's no EMF strong and compact enough for standard infantry use. You need a VERY long rail to reach velocities to that of tradition ammunition.