Retirement tax questions

IRS Form 8606 should have been filed for the non-deductible portion of the IRA contributions.  This will show your cost basis in the IRA.

TT will calculate and adjust the taxable amount of the distribution by a pro rata amount equal to the ratio of the non-deductible amount to the total value of all your IRAs.

If this is from a 401(k), the plan administrator should have reported the percentage of the non-taxable amount attributable to the distribution.