Can I offset $14k capital gain from stock with a $11k capital loss from bad debit if I claim both in the same year?

Trying to avoid the $3k maximum deduction for capital gains.