Yes, you can withdraw contributions you made to your Roth IRA anytime, tax- and penalty-free.
Please follow these steps to enter your 1099-R and the basis of your Roth IRA (step 6):
You can check your entry on line 4 of Form 1040.
Thank you for your response, however, I don't get any of those questions. I even tried deleting the 1099-R and reentering it, putting the $18,000 in Box 5 and 3271.75 in Box 6, but nothing changed. TT still shows the Total withdrawal as income.
Sorry, I didn't go far enough to get to the questions. I did as you instructed and TT still shows the $21,217.45 withdrawal as 2020 income.
Please enter your 1099-R as shown on the form. Then after you entered all 1099-Rs please click "CONTINUE" on the "Review you 1099-R info" screen. You have to continue for the questions to show up. After you clicked "continue" there first will be a disaster question and then the Roth IRA questions will show up.