to lower promotional costs and sales leverage.
General and administrative expenses were 6.0% of revenue for the second quarter of 2017, a decrease of 110 basis points over the second quarter of 2016 primarily due to sales leverage. In dollar terms, general and administrative expenses decreased $0.7 million compared to the second quarter of 2016 due to lower legal expenses, partially offset by increased bonus expenses and non-cash stock based compensation expense.
Net income for the second quarter of 2017 increased 161% to $66.7 million, or $2.32 per diluted share, compared to net income of $25.6 million, or $0.87 per diluted share, in the second quarter of 2016.
Results for the six months ended June 30, 2017
Revenue for the first six months of 2017 was $2.24 billion, up 22.1% from the first six months of 2016. The increase in revenue was driven by a 12.5% increase in comparable restaurant sales and to a lesser extent by new restaurant openings. Comparable restaurant sales improved primarily due to an increase in customer visits, along with an increase in average check as a result of a reduction in promotional activity.
We opened 107 new restaurants during the first six months of 2017, and closed or relocated 18 restaurants, including the closure of 15 ShopHouse restaurants, bringing the total restaurant count to 2,339.
Food costs were 34.0% of revenue, a decrease of 70 basis points as compared to the first six months of 2016. The decrease was driven by cost savings from bringing the preparation of lettuce and bell peppers back to our restaurants, and lower food waste and testing costs. These combined cost savings were partially offset by higher avocado prices.
Restaurant level operating margin was 18.3% for the six months ended June 30, 2017, an improvement from 11.6% in the first six months of 2016. The increase was driven by sales leverage, labor efficiencies, and a decrease in promotional expenses. Marketing and promotional expenses were 3.5% of revenue during the first six months of 2017 compared to 5.4% of revenue during the first six months of 2016.
General and administrative expenses were 6.2% of revenue for the first six months of 2017, a decrease of 100 basis points compared to the first six months of 2016, primarily due to sales leverage. In dollar terms, general and administrative costs increased $6.8 million compared to the first six months of 2016 due to increased non-cash stock based compensation expense and bonus expense, partially offset by lower legal costs, and lower meeting costs due to an all-team employee meeting held in February 2016. Stock compensation expense was higher during the first six months of 2017 because the first six months of 2016 included a reduction in expense for performance share awards that were no longer expected to vest against performance criteria.
Net income for the first six months of 2017 was $112.9 million, or $3.92 per diluted share, compared to net loss of $0.8 million, or $0.03 per diluted share, for the six months ended June 30, 2016.
Update on Data Security Investigation
Chipotle also reported today the completion of a forensic investigation into the previously-disclosed payment card security incident involving Chipotle restaurants. Based on the findings of the investigation as of May 26, 2017, Chipotle posted a list of restaurants apparently affected and specific time frames, along with steps guests can take, at www.chipotle.com/security and www.chipotle.ca/security. The time frames that were initially listed varied by restaurant but began no earlier than March 24, 2017, and ended no later than April 18, 2017. Updated findings from the completed investigation have confirmed the original time frames listed for almost 99% of the restaurants, or found that some were even shorter than what was originally reported. For 1.2% of the affected restaurants, the time frames were slightly broadened from what was initially listed, although still within the March 24, 2017, to April 18, 2017, time frame. Additionally, for one restaurant, the time frame may include March 17, 2017, and two additional restaurants have been added to the list of affected restaurants in Canada.
To view the updated time frames by restaurant, guests can visit www.Chipotle.com/security (U.S. locations) or www.chipotle.ca/security (Canada locations).