How exactly does the Net Investment Income Tax work on real estate? As a single filer I understand the threshold is 200k.

So in more detail. For example if i had a gain of 250,000 with the threshold for me being anything over 200,000, what amount is taxable at the 3.8%?  Is it the entire gain of 250,000? Or would it be only 3.8% of the 50,000 that was past the threshold? Thanks for any advice!