Distributions From IRA

How do I calculate my IRA basis if I have multiple IRAs, have made some deductible and some non-deductible contributions in prior years, and have taken partial distribution(s) from one or more IRAs last year. Need this to be able to calculate the portion of my 2021 IRA distributions that are taxable.