The length of a Tropical Year is approximately $365.2422$ mean solar days.
* * *
**Julian Calendar**
The Julian Calendar approximates the length of a tropical year as $$ 365.25=365+\tfrac14 $$ Therefore, it adds one leap year every $4$ years.
Thus, every year that is divisible by $4$ is a leap year.
* * *
**Gregorian Calendar**
The Gregorian Calendar approximates the length of a tropical year as $$ 365.2425=365+\tfrac14-\tfrac1{100}+\tfrac1{400} $$ Therefore, it adds one leap year every $4$ years, skipping one every $100$ years, but adding one back every $400$ years.
Thus, every year that is divisible by $4$ is a leap year except for those divisible by $100$ but not $400$.