The PC manufacturer said that it reached its decision after evaluating the strategic, financial and operational impact of spinning off the business unit - the world's biggest manufacturer of desktop and notebook computers for consumers and businesses.
The unit supplies a third of HP's revenue, but is its least profitable division.
Hewlett-Packard President and CEO Meg Whitman said keeping the unit within the company is right for the company, its customers, shareholders and business partners.
Deciding what to do with the unit has been one of Whitman's biggest challenges since joining HP in September.
A month before her appointment as chief executive, former CEO Leo Apotheker said the PC business would go up for sale in a badly blundered announcement that hastened his demise.
Apotheker's disclosure likely devalued the unit in the eyes of potential buyers. Many analysts speculated that HP had no choice but to keep the business and work on repairing strained relationships with customers.
Carving out the business would have been a tricky kind of surgery, given its enormity. Steve Diamond, an associate professor at Santa Clara University School of Law, said "tearing apart a business unit of that size is like taking out organs."
"It's very painful. It's like dividing Siamese twins. It's very, very difficult to do and you don't know how it's going to come out," he said.
HP appears to have reached a similar conclusion.
The company said that its evaluation of the business unit revealed a deep integration across key operations, such as its supply chain and procurement. Ultimately, the review found that the cost to recreate these operations in a standalone company outweighed any benefits of selling the PC unit.
PCs are an area in which HP leads. But the company wanted to abandon the business because its profit margins are thin. In the more profitable areas where HP needs to expand, it is playing catch-up. In technology services it has to contend with none other than market leader IBM Corp. HP's technology services division is one of several businesses that former CEO Apotheker identified as the victim of underinvestment.
Shares of Palo Alto, Calif.-based HP added $1.24, or 4.8 percent, to end regular trading at $26.99.