How to use the nmea sentence checksum and parser
- Paste NMEA 0183 sentences, one on each line. They start with $ or !, and a checksum may follow a star at the end.
- Read whether each checksum matches, and what it should be for those that are wrong or missing.
- For GGA and RMC sentences, read the decoded time, latitude, longitude, fix quality, speed, course and date.
- Copy the result to get the sentences with the right checksums added.
Formula
Checksum = XOR of every character between $ and *
Decimal degrees = degrees + minutes / 60
km/h = knots x 1.852
The checksum is written as two hex digits. South and west coordinates become negative numbers.
The standard GGA and RMC samples
The sentence $GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47 has the checksum 47 and the tool confirms it. The position 4807.038 N is 48 degrees and 7.038 minutes, which is 48.117300 in decimal degrees, and 01131.000 E is 11.516667. The fix quality 1 is a GPS fix with 08 satellites.
The RMC sentence ends in *6A, which also matches. Its speed of 022.4 knots is 41.48 km/h, its date 230394 is 1994-03-23, and its magnetic variation is 003.1 degrees west. A GLL sentence with no checksum is listed with the checksum it should have, 31, and the copied text contains it.
How NMEA sentences are built
A sentence is a line of text from a GPS receiver or another marine or navigation device. It starts with $, then a two-letter talker such as GP for GPS and a three-letter sentence type such as GGA or RMC, then comma-separated fields, then * and a two-digit checksum. The checksum catches single-bit errors on a noisy serial line and is how a program knows a line was cut or garbled.
Empty fields are common. A receiver that has no fix sends commas with nothing between them, and the decoded list only shows the fields that have values.
Where the position comes from
Position fields use degrees and decimal minutes packed together, so 4807.038 means 48 degrees and 7.038 minutes, not 4,807 of anything. The tool converts them with exact decimal arithmetic and rounds to six places, which is about 11 centimeters. The two-digit year in an RMC date is read as 19xx from 80 up and 20xx below 80.
Convert the result into degrees, minutes and seconds with the Coordinate Format Converter, or analyze a whole track file with the GPX Track Statistics Calculator. For other check values see the CRC Calculator, and to look at raw bytes, the Hex Viewer.
Assumptions and limits
- Only plain ASCII text is read. A line with other characters is rejected.
- Only GGA and RMC sentences are decoded. Other types are listed as numbered fields.
- A line with a checksum that is not two hex digits is rejected with a message.
- The sentences shown are the widely used samples, not live data.
Frequently asked questions
Why does the tool show the checksum in capitals?
It writes the two digits in upper case, as most devices do. A checksum typed in lower case is accepted and compared in upper case.
Are the $ and * part of the checksum?
No. The checksum covers the characters between them. The $ or ! at the start and the * are left out.
What do the letters N, S, E and W do?
They give the hemisphere. South latitudes and west longitudes become negative decimal degrees.
Can I decode AIS sentences?
The checksum of a line starting with ! is checked, but the payload of AIS messages is not decoded here.