recaptured dep

how do you determine how much dep u recapture

since the idea of dep is to write down the value of an asset and if upon sale instaed of declining it has actually increased then then what you saved in taxes has to be taxed back upon sale. e,g if th assert was bought at $5000 and you charged 2000 dep over the years and you sale it at 8000 then the whole $2000 has to be added back and be taxed. but if the increase in value is not too high you recapture propotionately

so if sale price 6k then 1k 5k then 0 4k still 0?

Purchase price = 5K Acc. Dep = 2K Book Value = 3K Sale Price = 8K Recap Depr = 2 Sale Price = 5K Recap Depr = 2 Sale Price = 4K Recap Depr = 1

thank you