Tech giants Google and LinkedIn may be rivals online, but they're collaborating in the real world on a Silicon Valley land swap.

Google and LinkedIn say they have completed a swap that will give Google LinkedIn's current headquarters in Mountain View. In return, LinkedIn receives property elsewhere in the city, where it will build a new headquarters.

LinkedIn also is taking over property leased by Google in Sunnyvale. The Silicon Valley Business Journal reports the deal involves 1 million square feet of existing buildings and 2.4 million square feet for development.

A LinkedIn spokesperson says the move will allow the company to consolidate 3,700 employees into a single campus years earlier than planned. A Google spokesperson says both companies are "excited to move forward with our respective development plans."