The commercial real estate data provider CoStar Group announced Wednesday that it had acquired LoopNet, another data firm with which it had competed and sparred in court over intellectual property rights.

CoStar, based in the District, will purchase all of the outstanding shares of San Francisco-based LoopNet for about $18.75 per share. Boards for both firms voted unanimously to support the deal.

Both companies provide information on millions of square feet of real estate nationally via the Internet. CoStar operates a subscriber-based real estate database chronicling ownership and leasing information for more than 77 billion square feet of office, retail and industrial inventory through about 1.5 million listings. LoopNet has 4.8 million registered members and more than 6 million unique visitors quarterly. The firms’ combined revenue last year was $321 million.

Andrew C. Florance, CoStar’s president and chief executive, said the acquisition was a bet by CoStar that the commercial real estate market was rebounding and would continue to grow as the country added jobs and filled empty or partially empty buildings. CoStar and LoopNet grow when the commercial real estate market is strong, he said.

“If you get job growth and you have zero new supply, which is what we essentially have here in the United States, you’re going to have tightening vacancy rates,” he said.

In addition, although the two subscriptions will remain separate and the LoopNet brand will continue, Florance estimated that $20 million could be saved in the first two years by eliminating back office redundancies. Although CoStar has made more than a dozen acquisitions since its founding by Florance in 1987, the LoopNet deal is by far the largest, topping its acquisition of in 2000.

Richard Boyle, chairman and chief executive of LoopNet, issued a statement saying the two companies “have been at the cutting edge of innovation in their respective businesses” and that the transaction “combines the capabilities and best practices of two successful and very complementary companies.”

For years, the two firms have been linked not by their complementary characteristics but by legal disagreements, with CoStar suing LoopNet for copyright infringement because LoopNet users had posted photographs online of buildings for which CoStar owned the copyright. The companies announced a settlement on all outstanding lawsuits in 2009.

Florance played down the firms’ competition, partly because CoStar’s strength is with commercial customers and LoopNet’s is with individuals. CoStar relies on the work of 900 researchers to compile data on high-value properties in urban areas, and LoopNet allows users to post their own property information and has listings that span small towns and farms throughout the country. Florance said LoopNet’s listings would immediately allow CoStar to add more than 500,000 listings.

“We’re really about data, and they’re more about sales,” Florance said. “We’re very urban, they’re rural and suburban and middle America.”

Florance also said the legal battles had given him and Boyle opportunities to form a relationship. “We got to know each other through litigation,” he said.