Railguns consist of two parallel metal rails, between which a projectile held in an armature is loaded, completing a circuit between them. A massive electrical current of the order of one million amperes is applied, creating an electromagnetic field, which in turn produces a force that accelerates the projectile along the rails.
Railgun projectiles are generally non-explosive, relying on their enormous speed to destroy the target and thus reducing the risk of a fire on board a ship, and comparatively small and lightweight, so they can be more readily transported and stored. The kinetic energy they deliver could do as much damage as a Tomahawk missile, enabling them to travel clean through a ship.
Kinetic Energy = 1/2 * mass * velocity squared. KE=1/2mv^2