Q. When is Sunset, is it when the bottom part of the sun first hits the horizon or when the top part of the sun hits the horizon?

A) It is clear from the Shulchan Oruch (O.H. 261: 2), other Poiskim and it is also the common accepted norm, that the shkiah begins when the complete body of the Sun disappears bellow the horizon. That is for both opinions as to when the time of doubtful or sofek Shabbos begins. (According to Rabeinu Tam the first Shkiah also is counted from the time of complete setting of the body of the Sun.

However there are some dissenting opinions that maintain that the sunset begins before (see Tosafos Horosh on Shabbos 35).

In using astronomical tables to calculate the shkiah, the time of sunset is also defined on those tables, as the moment when the trailing edge of the Sun’s disk disappears below the horizon. (NOAA.org) A caveat is that the ray path of the light from the setting Sun is highly distorted near the horizon because of atmospheric refraction, making the sunset appear to occur when the Sun’s disk is already about one diameter below the horizon (Leket Yosher p. 441).

Horav Shlomo Miller’s Shlit”a opinion is that it is commonly at least one minute off. We should be stringent to add two minutes to the times quoted.

Rabbi A. Bartfeld as revised by Horav Shlomo Miller Shlit”a