Net self employment income to determine employer contribution for solo 401k
I recently started a small business as a sole proprietor. I'd like to contribute to a solo 401k whereby I max out my employee contribution at $20,500 as well as the employer-side contribution. My understanding based on IRS rules is the amount I can contribute to the employer contribution is 20% of net self employment income for the employer contribution, up to $61,000 for both employee/employer contributions in 2022.
How do I go about determining my net self employment income? Is it simply the business profit (i.e., gross income) less Schedule C (business) expenses? Would I also deduct half my self employment taxes as well to compute net income?