If you don't anticipate the need to sell all of your shares, start by selling any lots that have gone down in value, then sell the ones with minimal gains, then sell the ones with larger gains last. You're right that you'll owe the tax on these eventually, but deferring this cost as long as possible does add real value.