"I want to thank everybody for giving me the opportunity to serve in this great city," he said.
Ramsey's retirement will be effective on January 7th, the anniversary of his swearing-in back in 2008. He thanked Mayor Michael Nutter, whose second term also ends in January.
"I came out of retirement to come to Philadelphia and work for him, and I'm honored to leave with him as well," Ramsey said.
A new mayor will take office, and Ramsey said the new mayor needs to be able to pick his or her own team. But, he says there is no better choice in the country than first deputy commissioner Richard Ross.
"There's a lot of talent inside our department, if that's what they choose to do," Ramsey said.
The commissioner also took a moment to thank the families of the eight police officers who were lost in the line of duty during his tenure.
"There are times I don't know if I can get through that period myself, but when I look at them and I see how they're handling things, it makes me move forward," he said. "I want to thank them for their sacrifice, and their strength, and their courage."
"As long as I live I'll never forget them."
President Obama released a statement on Ramsey's retirement, which reads:
"I want to offer my heartfelt gratitude to Commissioner Charles 'Chuck' Ramsey for his nearly five decades of leadership and service with some of this nation's largest law enforcement agencies. From Chicago to DC to Philadelphia, Commissioner Ramsey has always supported our women and men in uniform and the communities they bravely serve and protect each and every day. While I've known about his outstanding work over the years, it was when I appointed Chuck as a co-chair of my Task Force on 21st Century Policing that I was able to rely on his counsel and leadership. For several months earlier this year, he played a vital role in bringing together leaders from across the country to create a clear and concise report including key recommendations for building stronger trust between communities and the law enforcement agencies that protect them. I am extraordinarily grateful for Chuck's service and wish him an enjoyable and restful retirement."
When he arrived, the city was in the grips of a wave of violence with 316 homicides the previous year. Mayor Nutter gave Ramsey credit for making a big dent in those numbers.
"Compared to this time in 2007, our homicide total for the year is down 33 percent," Nutter said.
During Ramsey's tenure the city had a record number of police involved shootings. He asked the Justice Department to come in to investigate and the feds issued a critical report.
"It was critical, there's no question about that. But if I thought everything was running on all cylinders, I never would have asked them to come in and take a look," Ramsey said. "I knew we had issues, but when you're close to something you don't always see everything you need to see."
The police department is now implementing many of the recommendations spelled out in the Justice Department report. But, while other cities were erupting with unrest over police shootings, Philadelphia stayed calm.
Ramsey says it may or may not be due to the city's focus on community policing and building relationships.
"You work as hard as you can to build relationships so no one incident can tear it down. But I don't think any chief in America could say 'it could not happen here,'" said Ramsey.
Ramsey's service as commissioner followed posts as the chief of the Metropolitan Police Department in Washington, D.C. and the Deputy Superintendent of the Chicago Police Department.
Overall, he's served in law enforcement for 47 years.
Ramsey has also been in the national spotlight as the co-chair of President Barack Obama's Task Force on 21st Century policing, an effort to strengthen police and community relations across the country.
His announcement comes after an event on Tuesday night, in which Ramsey was interrupted by protesters as he participated in a town hall meeting at the National Constitution Center.
But unlike his last run-in with protesters where Ramsey walked away, this time he stayed and listened until officers felt it was disruptive and the protesters were removed.
The protesters chanted the names of people killed by police, including Brandon Tate-Brown. Tate-Brown was shot to death by police officers last December in Mayfair, but the officers were cleared of any wrongdoing.
During the event, Ramsey didn't shy from controversial topics like releasing names of officers involved in shootings.
"I think at some point in time we have to understand you can't shoot people and remain anonymous," Ramsey said.
He also shared his ideas on stop and frisk.
"Just because you stop an individual you don't automatically have to search them, depends on the stop, depends on whether or not you think that person is in possession of a weapon," Ramsey said.
A native of Chicago, Illinois, Ramsey served in the Chicago Police Department for nearly three decades in a variety of assignments.