What Is NTP (Network Time Protocol)? The Basics Explained

It is the quiet protocol working behind your device's "set time automatically" option.

What NTP (Network Time Protocol) is

NTP is a standard protocol that lets computers, servers, and network equipment periodically check their own internal clock against accurate time servers on the internet, using UDP port 123. It works much like glancing at a radio time signal to correct a wristwatch, except devices do it to each other automatically.

Why accurate time actually matters

Browsers validate an HTTPS certificate's expiry window against your device's own clock, so a badly skewed clock can trigger certificate errors on perfectly valid sites. One-time password (OTP) authenticator apps generate codes based on the current time, so a large time gap between device and server causes repeated authentication failures. Comparing logs across multiple servers in the right order also only makes sense if every server's clock agrees.

The stratum hierarchy

Stratum 0 refers to a top-level reference clock, such as an atomic clock or GPS receiver, that is not itself connected to a network. A server directly attached to that reference becomes stratum 1 and supplies time to other servers; a server that references a stratum 1 server becomes stratum 2, and so on. The lower the stratum number, the closer that server sits to the original reference clock.

How NTP corrects for error

An NTP client queries several time servers, estimates the round-trip network delay from the time between sending a request and receiving a reply, and calculates the offset between its own clock and each server's reported time. It discards outlier responses and, rather than jumping the clock abruptly, gradually speeds up or slows down its own clock rate β€” a method that typically keeps devices synchronized to within milliseconds to a few tens of milliseconds.

Where NTP shows up in everyday devices

Windows, macOS, Android, and iOS all include a built-in "set time automatically" feature that runs on NTP under the hood. If that setting is turned off, or a firewall blocks NTP traffic on UDP port 123, a device's internal clock will gradually drift, eventually causing problems like failed sign-ins or certificate errors that seem to come out of nowhere.

The security risk tied to NTP

A loosely configured public NTP server can be abused for an NTP amplification attack, where an attacker sends a small spoofed request that tricks the server into sending a much larger response to a victim's IP address, forming one variety of DDoS attack. Anyone running their own NTP server is generally advised to restrict who can query it and keep the software patched against known vulnerabilities.

Why NTP still matters even with GPS everywhere

GPS receivers deliver extremely accurate time, but most everyday devices β€” laptops, phones indoors, IoT sensors, servers in a data center β€” have no GPS receiver of their own and no clear line of sight to satellites anyway. Instead, they climb the stratum hierarchy: a handful of GPS- or atomic-clock-connected stratum 1 servers distribute time down through a large pool of public and organizational NTP servers, so accurate time reaches virtually every internet-connected device without needing its own reference clock.

A caveat: NTP's precision has real limits

Typical NTP synchronization lands within single-digit to a few tens of milliseconds, which is more than good enough for browsing, authentication, and general logging. Financial trading systems, telecom networks, and scientific instruments that need microsecond- or nanosecond-level precision instead rely on PTP (Precision Time Protocol), a more demanding standard designed for controlled, low-latency networks rather than the open internet. If a project's requirements mention sub-millisecond timing, NTP alone is usually not the right tool.

Frequently Asked Questions

What actually goes wrong if a computer's clock is off?

Common symptoms include certificate errors when visiting otherwise normal HTTPS sites, two-factor authentication (OTP) codes that keep getting rejected as invalid, and difficulty comparing logs from multiple servers in the correct chronological order.

Do smartphones sync time using NTP too?

Yes. Most smartphones automatically sync their clock over the carrier network or the internet whenever an option like "use network-provided time" is enabled in settings. Turning that option off leaves the phone relying solely on its own internal clock, which can gradually drift out of sync.