Per the IRS:
You must make a special computation to figure the maximum amount of elective deferrals and nonelective contributions you can make for yourself. When figuring the contribution, compensation is your “earned income,” which is defined as net earnings from self-employment after deducting both:
- one-half of your self-employment tax, and
- contributions for yourself.
Use the rate table or worksheets in Chapter 5 of IRS Publication 560, Retirement Plans for Small Business, for figuring your allowable contribution rate and tax deduction for your 401(k) plan contributions. See also Calculating Your Own Retirement Plan Contribution.
TurboTax calculates the limit correctly. There are separate boxes for the $19,500 regular contribution and for the $6,500 catch-up contribution. As SweetieJean indicated, your maximum contribution is limited to net earnings from self-employment. Your net earnings from self-employment are net profit minus the deductible portion of self-employment taxes.