The social network site did not say how many passwords were affected.
A Twitter spokesman said an internal investigation found no indication passwords were stolen or misused by insiders but told all users to consider changing their passwords "out of an abundance of caution".
"When you set a password for your Twitter account, we use technology that masks it so no one at the company can see it," a spokesman said.
"We recently identified a bug that stored passwords unmasked in an internal log. We have fixed the bug, and our investigation shows no indication of breach or misuse by anyone.
"Out of an abundance of caution, we ask that you consider changing your password on all services where you've used this password."
WARNING: Millions of Twitter users are being urged to change their passwords
Twitter discovered the bug a few weeks ago and has reported it to some regulators, according to reports.
The Twitter spokesman continued said: "We mask passwords through a process called hashing using a function known as bcrypt, which replaces the actual password with a random set of numbers and letters that are stored in Twitter's system.
"This allows our systems to validate your account credentials without revealing your password. This is an industry standard.
"Due to a bug, passwords were written to an internal log before completing the hashing process. We found this error ourselves, removed the passwords, and are implementing plans to prevent this bug from happening again.
Lou must be joking! Twitter reacts to Prince Louis name
Twitter explodes with Prince Louis memes as the royal babys name is announced to the worldTwitter One writes 'We are all thinking the same thing #iJustWannaBeJustLikeYou'
“Change your password now”
"We are very sorry this happened. We recognise and appreciate the trust you place in us, and are committed to earning that trust every day."
The glitch was related to Twitter's use of a technology known as "hashing" that masks passwords as a user enters them by replacing them with numbers and letters, according to the blog.
A bug caused the passwords to be written on an internal computer log before the hashing process was completed, the blog said.
The company advised users to take precautions to ensure that their accounts are safe, including changing passwords and enabling Twitter's two-factor authentication service to help prevent accounts from being hijacked.