It's about to get easier to compare prices at some big online stores.

New York's attorney general said Tuesday that Costco, CVS, FreshDirect, Wal-Mart and Walgreen have agreed to list unit prices on their websites and mobile apps for shoppers nationwide in the coming months. Amazon.com, the world's largest online retailer, did not agree to participate, according to Attorney General Eric T. Schneiderman.

A unit price tells consumers how much a product costs by each unit of weight. It divides the full price of the item by the size of its packaging. For example, a 16-ounce bottle of shampoo costing $5.99 would have a unit price of $0.37 per ounce. Because the same product can be sold in several different sizes, a unit price is a better way to compare whether a giant bottle of shampoo is really a good deal compared to a smaller one.

Retailers already list unit prices in stores, but they're harder to find online.

Costco and Wal-Mart will add them online before the end of this year. Wal-Mart said it already offers unit prices on some of the pet food it sells at Walmart.com and for the online grocery delivery service it's testing in San Francisco and Denver.

CVS Caremark, FreshDirect and Walgreen, including its Drugstore.com subsidiary, will provide unit prices by March 2015.

All the companies also agreed to add unit pricing for any future online stores they may open.

Although Amazon lists unit prices for some items, it doesn't do so consistently, the attorney general's office said in a statement. The company promised to list unit prices for its subsidiary Quidsi, which runs Diapers.com, Soap.com and other shopping sites, but didn't commit to it in writing, the attorney general's office said. Amazon and Quidsi did not immediately respond to a request for comment.