Spoke length calculators such as this typically rely on two standard hub measurements for each hub flange: pitch circle diameter, which is the diameter of the circle about which the spoke holes are drilled, and flange to center distance, which is the distance between the center of the hub and the center of the left or right flange.
Shimano publish the pitch circle diameter of their hubs, but otherwise describe their hubs using different measurements which must be converted to flange distance using some math which is simple but easy to be confused by. This document posted in mbtr.com describes the procedure pretty well but I thought I would add my own explanation to help clarify a few confusing aspects.
The most important dimensions given for Shimano hubs are flange distance and offset. What Shimano calls flange distance is the distance between the two flanges, and offset is how far the flanges are offset left or right from the overall center of the hub. The confusing thing here is that Shimano does not specify whether this offset is left or right of center, so this must be intuited as follows:
-Front rim brake hubs have no offset
-Front disc/roller brake hubs are offset to the right because the brake disc is attached to the left side of the hub
-Rear hubs are offset to the left because the freewheel, freehub body or sprocket is attached to the right side of the hub, and even if the rear hub has a disc brake the effect of the sprocket is greater than the potential effect of the brake disc, which means that the hub is always offset to the left.
In order to actually calculate flange to center distance, Shimano’s flange distance is simply divided by two and then the offset is added to or subtracted from the result depending as follows:
\text{Front Hub Left Flange to Center}=\frac{\text{Flange Distance}}{2}-\text{Offset}
\text{Front Hub Right Flange to Center}=\frac{\text{Flange Distance}}{2}+\text{Offset}
\text{Rear Hub Left Flange to Center}=\frac{\text{Flange Distance}}{2}+\text{Offset}
\text{Rear Hub Right Flange to Center}=\frac{\text{Flange Distance}}{2}-\text{Offset}
The other minor detail is that Shimano measures to the outside edge of the flanges, but it is standard to measure to the center of the flanges. This difference is so insignificant that it doesn’t make an appreciable difference to the calculated spoke length and can safely be ignored.