Getty

Shares of software-as-a-service company Ellie Mae Inc. (ELLI surged 21% Tuesday after private-equity firm Thoma Bravo LLC said it was buying the company in an all-cash deal valued at $3.7 billion.

Elli Mae closed at $98.95 in Tuesday's trading on the New York Stock Exchange.

Under terms of the agreement, Ellie Mae shareholders will receive $99 in cash a share, a 47% premium to the 30-day average closing share price and 49% premium to the 60-day average closing price as of Feb. 1, Thoma Bravo said in a statement.

"Ellie Mae is leading the digital transformation of the residential mortgage industry, and we look forward to building on the company's successes and to our partnership through this next chapter of growth," said Holden Spaht, Thoma Bravo managing partner.

The deal, which is expected to close in the second or third quarter, includes a 35 day "go-shop" period, under which Ellie Mae can seek superior bids. However, Elli's board of directors unanimously has approved the transaction.

Ellie Mae processes some 35% of all U.S. mortgage applications. Its software streamlines and automates the process of originating and funding new mortgage loans, and facilitating regulatory compliance.