The Hebrew calendar is based on both the lunar and the solar cycles. Months are measured by one cycle of the moon around the earth. According to the Talmud, one complete cycle of the moon around the earth takes 29.53059 days (Masechet Rosh Hashana). This value is very close to the average value measured by NASA: 29.530588. Since the average value is about 29.5 days, months alternate between 29 and 30 days in the Hebrew calendar (see Table below).
The common year in the Hebrew calendar includes 12 months. But there is a difference of about 11 days between 12 lunar cycles and one solar cycle. One complete cycle of the earth around the sun takes 365.25 days. Within a one year period, 12 lunar cycles are completed in 12 X 29.53059 = 354.36708 days. Therefore the difference between 12 lunar cycles and one solar cycle is precisely 365.25 - 354.36708 = 10.88292 days.
To synchronize the lunar counting of days with the solar cycle, the Hebrew calendar includes leap years wherein the month of Adar is replaced by two months, Adar Alef and Adar Beit. Thus, a leap year in the Hebrew calendar includes 13 months.
The timing of the leap years is calculated with a periodicity of 19 years. In 19 years the total difference between the lunar and solar cycles is 19 x 10.88292 = 206.77548 days. This difference amounts to about seven 30 day periods (206.77548 / 7 = 6.892516). The number 19 cannot be divided evenly by 7. So the Hebrew sages decided that leap year will be declared on the following years of a 19 year period: 3, 6, 8, 11, 14, 17 and 19. Addition of seven 30 day months results in a further difference of 3 days (210-207=3) every 19 year cycle. To make up for this difference 3 days are added on the months of Cheshvan and Kislev during each 19 year period.
|1 Tishrei||1 Tishrei||30|
|2 Cheshvan||2 Cheshvan||29/30|
|3 Kislev||3 Kislev||29/30|
|4 Tevet||4 Tevet||29|
|5 Shevat||5 Shevat||30|
|6 Adar Alef||30|
|7 Adar Beit||29|
|7 Nissan||8 Nissan||30|
|8 Iyar||9 Iyar||29|
|9 Sivan||10 Sivan||30|
|10 Tamuz||11 Tamuz||29|
|11 Av||12 Av||30|
|12 Elul||13 Elul||29|
The account above presents major aspects of the calendar. Additional details can be found here.