Investors & landlords

I sold a four units rental property partly used as my principal residence 

in exchange for a new single home residential house but earned extra gain..What and how do you calculate taxes to both State and Federal?