Here's how to work out the Maidenhead square from a WGS84 lat/lon for a given location. There are 9 simple steps, and the calculations can easily be done by hand.

For a description of the Maidenhead Locator System please look at this Wikipedia article.

When I wrote this procedure I was thinking of writing some assembly language code for an LCD module, so I was looking for cheats and shortcuts to make programming easy. Thinking about it in this way makes the pencil-and-paper method easy too. The tricky part is that living in the southern hemisphere means you have to subtract degrees and minutes for latitude, but luckily you don't have to do it for longitude.

The easiest way is with decimal degrees, but the $GPRMC sentence from a GPS is always degrees and minutes. Actually the easiest way is to select "Maidenhead" from the GPS display menu… but this will not affect the $GPRMC sentence.

So, quick pencil-and-paper steps to calculate Maidenhead squares from degrees and minutes. In general you can keep the degrees and minutes separate, except for the first two steps if you are in the Southern or Western hemispheres:

- If the longitude is East, add 180 to the longitude. If the longitude is West then subtract the longitude from 180, since western longitude is negative. Don't forget the minutes.
- If the latitude is North, add 90 to the latitude. If the latitude is South then subtract the latitude from 90, since southern latitude is negative. Don't forget the minutes.
- Divide the longitude degrees by 2 and ignore the remainder. If the longitude degrees were originally odd, add 60 to the longitude minutes.
- Look at the new longitude degrees figure. The "number of tens" is the first "field" character A..R, and is encoded with A=0, B=1 to R=17
- Look at the latitude degrees figure. The "number of tens" is the second "field" character A..R, and is encoded with A=0, B=1 to R=17
- Look at the new longitude degrees figure again. The "number of units" is the first "square" digit, 0..9
- Look at the latitude degrees figure again. The "number of units" is the second "square" digit, 0..9
- Divide the longitude minutes figure (after adding 60 if necessary in step 3) by 5. The result, ignoring the remainder, is the first "subsquare" character a..x, and is encoded with a=0, b=1 to x=23
- Divide the latitude minutes figure by 2.5 (a quick way to do this is to double it and divide by 5). The result, ignoring the remainder, is the second "subsquare" character a..x, and is encoded with a=0, b=1 to x=23

Nine steps! Actually, more like seven, because you can pair steps 4&6 and

5&7.