The rules in this area are extremely complicated. You should refer to IRS Publication 925 to figure your basis.
After you finish your federal tax return, your information will accurately and automatically transfer into your state return. Just answer a few state specific questions, and you're done.
CompleteTax State is only $34.95 and includes: