Generally speaking, your cost basis is the fair market value of the shares on the day they vested—the same number reported as income on your W-2. That’s the price the IRS treats as what you “paid,” even though you received the shares as compensation. Any gain or loss at sale is measured from that number.