The easiest and safest way to work out the zakaah on what a Muslim has saved from his monthly salary is as follows:
Determine the month in which what you had saved from your salary reached the minimum threshold (nisaab) at which zakaah becomes due. Then when one hijri year has passed since this threshold was reached, pay zakaah on all the money you have, even what you have saved from your last month's salary which has only been in your savings for a few days.
Thus zakaah will have been paid for the amount for which a year has passed.
As for the savings from the months that came after that, you will have paid their zakaah in advance, and paying zakaah in advance is permissible; there is nothing wrong with it.
Shaykh Ibn Uthaymeen (may Allah have mercy on him) said: With regard to zakaah on monthly salaries, the best, easiest and safest way of paying it is to choose a particular month to count your wealth and pay zakaah on all of it.
For example: a man has the habit, every time the month of Ramadan begins, of counting what he has and paying zakaah on it, and he even pays zakaah on the salary for the month of Shabaan which comes before Ramadan. This is good and in fact gives peace of mind; we have not found anything easier than this.
If someone were to say that only a few days have passed since acquiring the wealth in Shabaan, we would say: it is zakaah that is paid in advance, and it is permissible for a person to pay zakaah one or two years in advance.
In that case we say that the best thing is for a person to choose a particular month in which he counts all his wealth and pays zakaah on that for which one year has passed and that for which one year has not yet passed.
End quote from Majmoo Fataawa wa Rasaa'il al-Uthaymeen, 18/175
We have previously published a number of fatwas which explain how to pay zakaah on salaries. See questions no. 26113, 50801, 94314
And Allah knows best.
Reproduced from Islam QA