Most investors probably avoid investing in companies with questionable morals because it could lead to poor brand strength. Thankfully, investors can weed out the troublemakers using research from global advisory firm Reputation Institute, which ranks companies' corporate social responsibility, or CSR, every year. Its Global CSR RepTrak ranking judges companies in a number of categories, including environmental, social, workplace, and regulatory records in 15 markets across the world.

But while it's smart to invest in companies with solid reputations, it's also important find companies that boast great cash flows. Without robust free cash flow -- the cash a company has left over after deducting capital expenditures from its operating cash flow -- a company can't pursue opportunities to boost shareholder value.

Fortunately, there are plenty of socially responsible companies that also have impressive cash flows. Let's check out the top three companies below, according to the Reputation Institute's CSR rankings.

Google
In 2014, Google (GOOG 0.86%) (GOOGL 0.91%) topped the list for the fourth year in a row. The search giant is well-known for valuing ethics over dollars in controversial markets and introduced its "Don't be evil" mantra more than a decade ago. 

Source: Pixabay.

In 2010, Google withdrew its search engine from mainland China after clashing with the government over censorship and alleged cyber attacks. Although Google's search engine is no longer active in mainland China, it still offers scholarships there through its Google China Social Innovation Cup for College Students, an annual competition for special projects focusing on social needs. Google also partnered with MercyCorps, Save the Children, Doctors Without Borders, and other organizations to support victims of the 2008 Sichuan earthquake.

The company also established Google Green, a corporate effort to use resources efficiently while supporting renewable energy. That's a win-win situation for both itself and the environment -- according to Google, the initiative reduced power requirements at its massive data by an average of 50%.

 Google wouldn't be able to make so many charitable contributions without a healthy cash flow. Over the past 12 months, Google's free cash flow rose 21% to $13.1 billion. That gives it plenty of capital for acquiring smaller companies or investing in new businesses, which could help Google diversify its top line beyond its core business of Internet advertising. 

Microsoft
Microsoft (MSFT 1.23%) came in a close second in the 2014 CSR rankings. The tech giant works with a wide range of governments, investors, nonprofits, and other organizations to collaborate with local communities. 

Source: Pixabay.

In late 2012, it introduced Microsoft YouthSpark, an initiative to connect "hundreds of millions" of youth to opportunities in education, employment, and entrepreneurship. That same year, it announced that it crossed a milestone of $1 billion in employee contributions (including company match) to over 31,000 nonprofits across the world over the past 30 years. That figure hit $1.1 billion last year.

Like Google, Microsoft is cutting back on carbon emissions with purchases of renewable energy. Thanks to those efforts, Microsoft's data centers now consume one-third less power than the industry average. The company also conducted 217 third-party audits of suppliers last year to ensure that they were compliant with environmental health and safety standards.

 Despite Microsoft's success in improving its social responsibility, the company faced bottom line challenges over the past year due to reduced prices for Windows and Office licenses. That caused its free cash flow to dip 1.7% over the past 12 months to $26.3 billion. However, that's more than enough to cover its dividend payments, which totaled $9.7 billion during that period. The stock's current annual dividend yield is 2.6%, according to S&P Capital IQ. Microsoft can boost shareholder value by shrewdly putting money into research and development or acquisitions -- both of which could strengthen its core software and hardware businesses. 

Disney
Disney (DIS 1.18%) ranked third in the 2014 CSR rankings. The House of Mouse's social responsibility initiatives include charities for natural disasters, such as the 2010 earthquakes in Haiti, and donations to environmental organizations. Disney also donates to various hospitals, performing arts centers, playgrounds, and other facilities across the United States.

Source: Pixabay.

The company established the Disney Worldwide Conservation Fund on Earth Day twenty years ago. The fund supports local and global nonprofits which protect wildlife, ecosystems, and aid local communities. As of 2013, the fund has supported over $20 million in projects in over 112 countries.

Since Disney is the largest media company in the world, it also makes movies and TV shows to encourage environmental education through Disneynature films, which is part of Walt Disney Studios. The proceeds from those films are used toward replanting trees in Brazil's threatened Atlantic Forest, protecting the coral reef in the Bahamas, and conserving wildlife corridors in Africa.

 Disney's positive reputation is complemented by its superb cash flow. Its free cash flow -- fueled by its robust media, film, and theme park businesses -- rose 9.7% to $6.8 billion over the past 12 months. Disney spent $1.5 billion of that cash on dividends during that period. Its stock currently pays an annual dividend yield of 1.0%, according to S&P Capital IQ.

The key takeaways
Nice guys don't always finish last in the stock market. Google, Microsoft, and Disney are shining examples of how companies can be philanthropic while generating strong cash flows. Companies which can do both show that they can help communities and enhance shareholder value at the same time.