Capital gains offsets question
Hello! I am looking to sell some securities (buying a house) and want to make sure my understanding of how this will work is correct. Investment account is a few years old, most investments have done well but a few are way down and outlook is tragic (should have sold much earlier but I was new and didn’t know what I was doing.) But basically, if I sell a couple positions that are up ~$15k and then two or three others that total loses of ~$15k, then those will offset in my taxes for next year, correct? If I’m wrong or missing any info, any additional advice is greatly appreciated!!
Also, I’m sure this is a very dumb question, I just need an answer from someone outside of my own brain but if initial investment was $5k, now worth $10k, I would only pay capital gains on the new $5k?