Thank you, Drew.
Before turning to our quarterly results, I'd like to start with a reminder of our financial strategy.
We continue to focus on balancing growth and profitability in a thoughtful, disciplined way. We remain committed to our long-term objectives, including delivering operating margins of 30% to 32% and generating annual free cash flow of $1 billion by 2024.
We also remain focused on allocating capital to growth initiatives, both organic as well as through acquisitions, while also returning a significant portion of our free cash flow to shareholders in the form of share repurchases. We believe that execution against these objectives will generate long-term value for our shareholders. Today, I'll talk to our performance for the quarter and our updated guidance for the year, each of which demonstrate that we continue to operate the business in line with these principles.
Let's begin with our second quarter results. Total revenue for the quarter increased 7.9% year-over-year to $573 million, beating our guidance range of $568 million to $571 million.
Foreign exchange rates provided an approximate $5 million headwind to growth, above our previous guidance range of a $3 million headwind. On a constant currency basis, year-over-year growth was 8.8%. Total ARR for the quarter grew 7.7% year-over-year for a total of $2.333 billion. On a constant currency basis, ARR grew by $44 million sequentially and 8.3% year-over-year.
We continue to drive growth in ARR through strength in our Teams and Professional plans, with retention improving year-over-year, driven by mobile enhancements and stronger renewals by our account management team as well as healthy cross-sell activity. HelloSign and DocSend also continued to show solid ARR growth. We exited the quarter with 17.37 million paying users and added approximately 280,000 net new paying users in the second quarter. Average revenue per paying user was $133.34 in Q2. ARPU decreased by $1.29 compared to Q1, primarily due to FX rate headwinds and continued strength from Family plan, which, as a reminder, is comprised of six seats and therefore, carries a lower ARPU profile.
Before we continue with further discussion of our P&L, I would like to note that unless otherwise indicated, all income statement figures mentioned are non-GAAP and exclude stock-based compensation, amortization of purchased intangibles, certain acquisition-related expenses, impairments of our real estate assets and net gains on equity investments.
Our non-GAAP net income also includes the income tax effect of the aforementioned adjustments. I'll now provide a brief update on our real estate strategy, where we are taking steps to de-cost our real estate portfolio as part of our transition to our Virtual First model. In the second quarter, we continue to make progress against our goals, executing subleases in San Francisco as well as Seattle.
As a result, we have now executed all of our planned subleases outside of San Francisco.
While we continue to estimate that our total impairment charges will be up to $450 million, lower than expected sub leasing in San Francisco resulted in an additional $9 million in impairment charges in Q2, bringing our cumulative impairment to $438 million. With that, let's continue with the P&L. Gross margin was 83% for the quarter, representing an increase of nearly 2 percentage points on a year-over-year basis. The improvement in our gross margin was primarily driven by ongoing efficiencies in our data center infrastructure as well as slower-than-expected onboarding of outsourced customer support.
Second quarter R&D expense was $155 million or 27% of revenue, which increased compared to 25% of revenue in the second quarter of 2021. The increase in R&D was primarily driven by an increase in headcount to reprice the elevated levels of attrition we saw last year and as we continue to invest in growth and other key initiatives.
Second quarter sales and marketing expense was $96 million or 17% of revenue, which remained flat as a percentage of revenue compared to the second quarter of 2021. Sales and marketing expense increased on a sequential basis, driven by a shift of some marketing campaigns from Q1 to Q2.
Second quarter G&A expense was $41 million or 7% of revenue, which decreased compared to 8% of revenue in the second quarter of 2021. In total, we earned an operating profit of $183 million in the second quarter, which represents an operating margin of 32%, which is flat compared to the second quarter of 2021.
Our Q2 operating margin exceeded guidance by over 3 points, driven by stronger-than-expected gross margin, efficiencies stemming from hiring in lower-cost locations, lower-than-expected T&E costs as well as the timing of spend shifting from Q2 to future quarters. Net income for the second quarter was $138 million, which is a 14% decrease versus the second quarter of 2021. Diluted EPS was $0.38 per share based on $366 million diluted weighted average shares outstanding, down from $0.40 per share based on $397 million diluted weighted average shares outstanding for the second quarter of 2021.
Our net income and EPS declined year-over-year as our income tax expense increased significantly year-over-year through the impact of new R&D tax legislation and given that we have now fully utilized our NOLs for non-GAAP tax purposes.
Moving on to our cash balance and cash flow. We ended the quarter with cash and short-term investments of $1.4 billion. Cash flow from operations was $210 million in the second quarter. Capital expenditures were $4 million during the quarter. This resulted in quarterly free cash flow of $206 million compared to $216 million in Q2 of 2021. In the second quarter, we added $14 million to our finance leases for data center equipment.
Let's turn to our share repurchase activity. In Q2, we repurchased 8.9 million shares, spending approximately $190 million.
During Q2, we exhausted our previous $1 billion share repurchase authorization from 2021 and began executing against our new $1.2 billion authorization that was approved in Q1 of this year.
As of the end of the second quarter, approximately $1.1 billion remains under the current authorization. I'd now like to share our guidance for the third quarter and provide an update to our full year 2022 guidance. I will also provide some context on the thinking behind this guidance.
For the third quarter of 2022, we expect revenue to be in the range of $584 million to $587 million.
We are assuming a currency headwind of approximately $13 million in the third quarter. Thus, on a constant currency basis, we expect Q3's year-over-year revenue growth to be roughly consistent with that of Q2.
We expect non-GAAP operating margin to be approximately 29%. The expected sequential decline from Q2 operating margin is primarily driven by the continued progress on our planned hiring strategy in 2022 towards growth initiatives, increased levels of T&E and project spend in Q3 as well as an incremental FX headwind. Q2 operating expenses also benefited from the onetime release of certain non-income tax reserves in the quarter.
Finally, we expect diluted weighted average shares outstanding to be in the range of 360 million to 365 million shares based on our trailing 30-day average share price.
For the full year 2022, due to the significant strengthening of the U.S. dollar since our last update, we are revising our as-reported revenue guidance range down by $12 million to $2.308 billion to $2.318 billion from our previous guidance range of $2.320 billion to $2.330 billion.
However, on a constant currency basis, we are revising our guidance range up by $8 million to $2.342 billion to $2.352 billion, up from the prior range of $2.334 billion to $2.344 billion. We now estimate a full year 2022 currency headwind of approximately $34 million as compared to our prior forecast of $14 million. We now expect gross margin to be approximately 81.5%, up from our prior forecast of 81% due to ongoing infrastructure efficiencies.
We are also raising our operating margin guidance to approximately 30%, up from our prior guidance of between 29% to 29.5%. This operating margin guidance is inclusive of an approximately 1 point headwind from FX as compared to a prior estimate of approximately 0.5 point.
We are maintaining our free cash flow guidance to be in the range of $760 million to $790 million. This includes $17 million in cash outflows for the 2022 installments of the acquisition-related deal consideration holdbacks.
Additionally, our free cash flow guidance is inclusive of an estimated $25 million headwind and resulting from the impact of R&D tax legislation newly effective in 2022.
We continue to expect capital expenditures for 2022 to be in the range of $25 million to $35 million.
We continue to expect additions to our finance lease volumes to be approximately 5% of revenue in 2022.
Finally, we expect 2022 diluted shares outstanding to be in the range of 364 million to 369 million shares, down from our previous guidance range of 366 million to 371 million shares. This reduction in our share count reflects our commitment to an anticipated impact of our share repurchase program. To share some additional context on this guidance.
For revenue, for 2022, we are raising our constant currency revenue guidance range up by $8 million.
As a reminder, our guidance continues to include the impact of discontinuing new sales, along with financial sanctions in Russia, resulting in a headwind in the mid- to high single-digit millions of dollars to revenue this year.
Additionally, this guidance also reflects updates to our pricing and packaging approach for our Teams plans that we announced in June.
As Drew discussed, we recently updated our Standard and Advanced Teams plans, bundling a number of new capabilities around security and data protection. These planned prices were raised by 20%.
New customers began purchasing the higher-priced plans starting in June, and existing customers began renewing at the higher price point starting in July.
As a reminder, we will see the benefit of the pricing change flow to ARR as customers' billing cycles occur with monthly customers flowing through in the first month of the change. And given our ratable revenue recognition model, the revenue impact will flow to both 2022 and 2023. The subset of our user base that is subject to the price increase comprises approximately 1/3 of our total ARR.
We are seeing positive early signals on this pricing and packaging change thus far.
Given this positive customer reception as well as continued year-over-year improvements in retention, we are raising our constant currency revenue guidance range.
As related to gross margin, while we achieved the gross margin level above the high end of our long-term target range in Q2, we continue to expect to invest in customer support, which will ultimately result in gross margin reverting within the parameters of our long-term guidance range in the coming quarters.
As related to operating margin, while we are experiencing incremental FX headwinds, T&E, and office reopening expenses as pandemic restrictions soften, we are raising our 2022 operating margin guidance as we continue to have success with our ability to hire top talent outside of traditional high-cost tech hubs such as San Francisco, New York and Seattle.
As related to full year free cash flow, we are maintaining our 2022 free cash flow guidance.
We are maintaining the range that we introduced at the beginning of the year as a result of the significant strengthening of the U.S. dollar, which is now more than a $30 million headwind to our initial free cash flow guidance. I know that FX has a more immediate impact on billings and hence, cash flow as compared to revenue, given our ratable revenue recognition model. Thus, a larger cash impact will be absorbed this year, offsetting the benefits of our increased operating margins.
Lastly, we remain committed to achieving our long-term targets of delivering operating margins of 30% to 32% and $1 billion of annual free cash flow by 2024. In conclusion, we continue to execute well against our initiatives, demonstrating stability and focus on our customers while driving continued operational efficiencies. This stabilization and discipline allows us to operate from a position of strength during an unpredictable macro environment as we continue to execute towards our long-term objectives. With that, I'll now turn it over to the operator for Q&A.