How can I calculate the VAT value from a given amount

I'm try to do a simple software but I need to understand the mathematical formula first...

have a given amount, for example 499,00 how do I retrieve how much of a given VAT percentage (let's imagine 25%)

I was thinking about the terms of:

499 = ${x}$ $\times$ 1,25

which would extract as:

${x}$ = 499 / 1,25

but that's not it and the numbers don't add you :(

Can anyone give me a "hand" on getting this right?

-
You need to explain more. What is VAT for instance? THe reason you might not be getting an answer is that it is hard to understand what you are asking. – Aryabhata Feb 9 '12 at 20:40
VAT stands for Value Added Tax and I want to know if an Apple costs 499 including VAT of 25%, how can I calculate how much is the VAT of that Apple. – balexandre Feb 9 '12 at 20:51
If the VAT is $25$%, and the price (including VAT) is $P$, then the price before VAT is indeed $\dfrac{P}{1.25}$, so the VAT itself is $P-\dfrac{P}{1.25}$, which simplifies to $P\dfrac{0.25}{1.25}$. Because of rounding, the actual amount of VAT may differ from this computed amount by a tiny bit. – André Nicolas Feb 9 '12 at 20:58
VAT in the UK is 20% - if the figures don't agree try that. – Mark Bennet Feb 9 '12 at 21:05
@AndréNicolas fell free to copy your comment into an answer, I will mark it as the correct answer. Thank you for the explanation! – balexandre Feb 9 '12 at 21:34

If the VAT is $25$%, and the price (including VAT) is $P$, then the price before the VAT was added is indeed $\dfrac{P}{1.25}$, exactly as you wrote.

Thus the VAT itself is $$P-\frac{P}{1.25}.$$ This simplifies to $$\frac{0.25}{1.25}P, \quad \text{that is,}\quad (0.2)P.$$ Because of rounding, the actual amount of VAT may differ from this computed amount by a tiny bit. The rounding procedure is probably specified in detail in the fine print of the VAT regulations. You could use that to get an absolutely exact answer. But in Canada, for example, the exact answer and the one computed as above would differ by at most $1$ cent. (That will change once the $1$ cent coin is abolished.)

More generally, suppose that the VAT rate is $r$, where for example if the rate is $25$%, then $r=0.25$, if the rate is $20$% then $r=0.20$, if the rate is $17.5$% then $r=0.175$.

If the price with VAT included is $P$, then the price before the VAT was applied is $\dfrac{P}{1+r}$

Thus the amount of VAT paid is $$P-\frac{P}{1+r},\quad\text{which simplifies to} \quad \frac{r}{1+r}P.$$

-