Yahoo said it believes the hack – which happened in 2014 – was carried out by a state-sponsored actor.
No financial information is thought to have been compromised.
Read more: Will Yahoo ever be a verb?
Account information, including names, email addresses, telephone numbers, dates of birth, hashed passwords and, in some cases, encrypted or unencrypted security questions and answers could have been stolen.
In a statement the internet company said:
Yahoo is notifying potentially affected users and has taken steps to secure their accounts.
These steps include invalidating unencrypted security questions and answers so that they cannot be used to access an account and asking potentially affected users to change their passwords.
Yahoo is also recommending that users who haven't changed their passwords since 2014 do so.
Media interest has focused around the potential implications for the $4.83bn (£3.7bn) deal Yahoo agreed earlier this year with US telecoms firm Verizon.
There has been speculation the hacking revelations could lead to an adjustment in the price of the transaction. According to a regulatory filing, Yahoo could have to pay Verizon almost $145m in break fees if the deal collapses.
In a statement, Verizon said it was notified of the security breach two days ago:
We understand that Yahoo is conducting an active investigation of this matter, but we otherwise have limited information and understanding of the impact.
We will evaluate as the investigation continues through the lens of overall Verizon interests, including consumers, customers, shareholders and related communities.
Until then, we are not in a position to further comment.
Shares in Yahoo dipped briefly when details of the hack were announced, though stabilised quickly and were trading down by 0.2 per cent just ahead of the New York market close.
The Verizon deal includes Yahoo's online search, Yahoo Mail and instant messaging, and its core ad business.
Yahoo will, however, hold on to its cash, its shares in Chinese ecommerce retailer Alibaba and Yahoo Japan, as well as convertible notes and some minority investments, and it will be renamed, becoming a publicly traded investment company.
The stakes in Alibaba and Yahoo Japan are the more lucrative parts of the business compared to the online division.
Yahoo first announced it was on the chopping block earlier this year. Several firms had been circling with interest in the dot-com giant, which at one point was worth more than $100bn.