Your combined income from all sources determines the tax rate. However; if you investment is long-term there are reduced rates. Short-term gains come from the sale of property owned one year or less and are typically taxed at your maximum tax rate, as high as 37% in 2024 and 2025. Long-term gains come from the sale of property held more than one year and are typically taxed at either 0%, 15%, or 20% for 2024 and 2025.
In your example of $5,000 at say 20% the Federal tax would be about $1,000 not considering other factors including state taxes if applicable.
Capital gains tax tips
TurboTax has a great tax caster for you to determine your tax liability: TaxCaster