Water change
How much water to swap to bring nitrate, TDS, or any dilutable parameter down to a target value.
The math
Replacing fraction f of your water with source water gives:
C_after = C_before * (1 - f) + C_source * f
Rearranged for f:
f = (C_before - C_target) / (C_before - C_source)
That's the whole calculator. Plug in current, target, and source values to find the swap fraction.
When the math lies
The dilution math assumes the parameter you're targeting can't be created inside the tank. For nitrate that's almost true, it's the end product of the cycle and only goes up between changes. For TDS, also close. For pH, false: pH is buffered by KH, and a 50% water change won't necessarily move pH halfway to your source water's pH. Use this for things that dilute linearly. Don't use it for pH or buffered chemistry.
Don't change too much at once
Anything past 50% in one go risks shocking fish via osmotic shift, temperature swing, or pH movement. If the math wants 70%, do three changes of 25 to 30% spaced a few hours apart. The fish don't care that it's slower, but they do care if everything moves at once.