Google searched its cash coffers and came up with a large deposit and signed a contract yesterday to buy the entire city-blockwide 111 Eighth Avenue, The Post has learned.

The price? A cool $1.8 billion.

The deal is expected to close before year-end and pricing adjustments are still possible, sources said.

Google, which has more than $33 billion in cash on its balance sheet, did not have to put up a 10 percent deposit, these sources said, but did put up “serious money.”

The deal is the largest US commercial real estate purchase by a tenant ever — and confirms an exclusive report in The Post on Oct. 27.

The marketing of massive 111 Eighth Ave. by investment maestro Douglas Harmon of Eastdil Secured attracted worldwide interest.

Harmon had been hired by Taconic Partners, Jamestown and New York State Common Retirement Fund with the idea that they would retain a piece of the building.

But Google made a compelling offer to buy all of the 3 million square footer that takes up a full block in Chelsea bounded by Eighth and Ninth avenues and 15th and 16th streets.

“Google will gobble up the space like Pac-Man,” said a source of the firm’s current 500,000 square feet occupancy and its future plans to take over space in the building as it becomes available.

“Google will grow and it’s a lot of jobs for the city,” the source said.

Led by a CB Richard Ellis team of Darcy Stacom, Bill Shanahan and Steve Siegel, Google beat out a host of competing bidders and started due diligence. It also went through an exhaustive process to pick lawyer Rob Sorin of Fried Frank to complete the contract.

“There were daily discussions and numerous questions over the economics and the physical asset,” said a source.

“It’s 3 million square feet and a lot of technology.”

A current mortgage will also have to be defeased from a larger mortgage pool at some additional cost running into the millions of dollars.

Google said it had “no comment at this time.” Its shares closed at $571.82, up $7.47. Various other parties declined comment or did not return messages prior to deadline.

lois@betweenthebricks.com