nmea checksum calculator

NMEA 0183 Checksum Tool

Paste a full sentence (with or without $/! and *CS) or just the payload, then calculate and validate instantly.

Checksum is computed by XOR-ing every character between $ (or !) and *.

What is an NMEA checksum?

In NMEA 0183 messages (commonly used by GPS receivers, chart plotters, AIS transponders, autopilots, and marine instruments), the checksum is a two-digit hexadecimal value used for basic error detection. It helps verify that the sentence was not corrupted in serial transmission.

A typical NMEA sentence looks like this: $GPRMC,092751.000,A,5321.6802,N,00630.3372,W,0.06,31.66,280511,,,A*43

  • Start character: $ (or ! for some talkers like AIS)
  • Payload: everything after the start character up to *
  • Checksum: two hex digits after *

How this checksum is calculated

XOR across payload characters

The checksum algorithm is intentionally simple: start with 0, then XOR each ASCII character code in the payload. Do not include the $, !, or * in the XOR operation.

Pseudocode:

checksum = 0 for each char in payload: checksum = checksum XOR ASCII(char) hex = uppercase(checksum, 2 digits)

Quick worked example

Payload: GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,, computes to checksum 47, so the full sentence is:

$GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47

Why checksum mismatches happen

  • Extra whitespace or hidden characters copied from logs
  • Including the leading $ in calculation by mistake
  • Including the * or trailing checksum digits in calculation
  • Lower-level serial issues (baud mismatch, noise, line termination problems)
  • Incorrect sentence modifications by middleware, scripts, or gateways

Using this calculator effectively

For sentence generation

If you are building custom NMEA output in Python, C, JavaScript, or embedded firmware, enter your payload without a checksum. The tool returns the correctly formatted full sentence with *CS.

For troubleshooting field data

Paste complete incoming sentences from your serial monitor. The calculator compares the provided checksum (if any) to the computed value and reports whether the sentence is valid. This is useful when diagnosing intermittent GPS dropouts or parser rejections.

Best practices for NMEA parsing

  • Always validate checksum before parsing payload fields.
  • Gracefully discard invalid lines rather than crashing your parser.
  • Log raw sentence + computed checksum during diagnostics.
  • Handle both $ and ! start characters.
  • Normalize line endings (\r\n) when reading serial streams.

Final note

NMEA checksums are simple but essential. A lightweight checksum check can prevent bad navigation data from entering your application. Bookmark this page as a fast validation utility whenever you're working with GPS, AIS, marine electronics, telemetry, or serial protocol tooling.

🔗 Related Calculators