The impact factor is calculated by dividing the number of citations in a given year by the total number of articles published in the two previous years. For example, if a journal has an impact factor of 10, it means that, on average, each article published in the journal over the past two years was cited ten times in the current year.