Do Submarines Have GPS?
Yes, and they almost never use it.
A submarine carries a GPS receiver on a mast. The receiver works perfectly. The problem is that it only works when the mast is above the surface, and a submarine at periscope depth with a mast up is a submarine that has given away most of the reason it exists.
Why the signal stops
Seawater is conductive, and conductive media attenuate radio frequencies fast. GPS transmits around 1.2 and 1.5 GHz, which is absorbed within centimetres of the surface. There is no clever antenna that fixes this. The physics is not negotiable.
Very low frequency transmissions do penetrate to shallow depth, which is how submarines receive one-way traffic without surfacing. The bandwidth is tiny and the propagation delay is significant, so VLF carries messages rather than position fixes.
What they use instead
Inertial navigation. A ship's inertial navigation system uses gyroscopes and accelerometers to measure every acceleration and rotation the hull experiences, then integrates those measurements continuously from a known starting position.
Modern systems use ring laser or fibre-optic gyros, which have no moving parts and drift far less than the mechanical gyros they replaced. It is genuinely self-contained. The boat emits nothing, receives nothing and still knows where it is.
Approximately. That is the catch.
How far it drifts
Every measurement carries a small error, and integrating a small error over time produces a growing one. A reasonable figure for a well-maintained system is around one nautical mile of accumulated error per 24 hours submerged.
That sounds tolerable, and for transit across an ocean basin it is. It stops being tolerable when you need to arrive somewhere precisely, or when you have been submerged for weeks. Error accumulates the entire time.
So the system gets reset. The boat comes to periscope depth, raises a mast, takes a GPS fix, and the navigation system corrects itself against a known position. Even a few seconds of reception is enough. Then it goes deep again with the error clock reset to zero.
The mast is a decision, not a routine
This is the part usually left out of explanations. Coming shallow to fix your position is a tactical trade.
The same mast carries electronic support measures, which scan for radar emissions and identify what is operating nearby. So the trip to periscope depth does several jobs at once: position update, communications, and a look at the electromagnetic environment. Commanders schedule it rather than doing it on a timer.
A mast breaking the surface can be detected. Whether that risk is worth an updated fix depends on where the boat is, who else is there and how much drift has built up. The navigation requirement and the tactical situation are argued against each other continuously.
Other ways to fix a position
Bathymetric navigation compares depth readings under the hull against a stored chart of the seabed, matching the profile the boat is flying over to a known contour. It needs good survey data for the area and distinctive terrain to match against. Flat abyssal plain gives you nothing.
Gravitational anomaly navigation works similarly, matching measured variations in the local gravity field to a reference map. It is entirely passive, emits nothing, and works where terrain matching does not.
Celestial fixes still exist. A periscope with a star-sighting capability can shoot a navigational fix the way a surface navigator has for centuries, which requires exposure but no electromagnetic emission at all.
The same problem, different vehicles
Everything above applies to autonomous underwater vehicles, which face the identical constraint with a smaller budget. AUVs pair inertial navigation with a Doppler velocity log measuring speed over the seabed, then correct against acoustic positioning from a surface vessel or by surfacing for GPS.
The military submarine version is simply better funded. The physics is the same in both cases, and it has not changed since the first boat went under: below the surface, you are on your own instruments, and your instruments are always slowly getting it wrong.