If you are younger than 59 1/2 you will pay an early withdrawal penalty for taking money out of your 401k and you will pay ordinary income tax on the money--not capital gains. And....you would have to prepare a form 709 gift tax form if you are just gifting the money to your child. If you take money out of your 401k you will receive a 1099R that has to be entered on your next tax return.
GIFTS
Money that you receive as a gift is not taxable income to you, and you do not need to report it on your income tax return. Money that you gave as a gift to someone else is not deductible for your taxes.
Turbo Tax does not support the gift tax form 709, but here is a link:
https://www.irs.gov/pub/irs-pdf/f709.pdf
https://turbotax.intuit.com/tax-tips/estates/the-gift-tax-made-simple/L5tGWVC8N
https://www.forbes.com/sites/ashleaebeling/2017/10/19/irs-announces-2018-estate-and-gift-tax-limits-...
**Disclaimer: Every effort has been made to offer the most correct information possible. The poster disclaims any legal responsibility for the accuracy of the information that is contained in this post.**