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.$