billion for the three months ended June 30, 2022. The average rate paid on interest-bearing liabilities for three months ended June 30, 2023 was 1.82% compared to 0.62% for three months ended June 30, 2022.
Interest expense on deposits increased $4.4 million, or 304.7%, to $5.9 million for the three months ended June 30, 2023 compared to $1.5 million for the three months ended June 30, 2022. The increase primarily was due to an increase in the average cost of deposits, specifically, money market accounts and certificates of deposit. The average rate paid on interest bearing deposits increased by 123 basis points to 1.61% for the three months ended June 30, 2023, compared to 0.38% for the three months ended June 30, 2022. The overall average cost of deposits for the three months ended June 30, 2023 and 2022 was 1.10% and 0.25%, respectively. The average balance of deposits totaled $1.5 billion for both the three months ended June 30, 2023 and the three months ended June 30, 2022, with decreases in the average balances of savings, NOW and money market accounts being offset by an increase in the average balance of certificates of deposit. The average balance of noninterest bearing deposits decreased $111.4 million, or 14.13%, to $677.5 million for the three months ended June 30, 2023 compared to $816.9 million for the same period in 2022.
Interest expense on borrowings increased $100,000, or 9.96%, to $1.1 million for the three months ended June 30, 2023, compared to $999,000 for the three months ended June 30, 2022. The average balance of borrowings increased $251,000 to $72.3 million during the three months ended June 30, 2023, compared to $72.0 million during the three months ended June 30, 2022. The average cost of borrowings increased to 6.09% for the three months ended June 30, 2023, compared to 5.56% for the three months ended June 30, 2022.
Interest expense increased $6.9 million, or 140.2%, to $11.8 million for the six months ended June 30, 2023 compared to $4.9 million for the six months ended June 30, 2022, reflecting higher funding costs related to increased rates of interest payable on our deposits and junior subordinated debentures. Total average interest-bearing liabilities decreased $81.6 million, or 5.5%, to $1.5 billion for the six months ended June 30, 2023, compared to $1.6 billion for the six months ended June 30, 2022. The average rate paid on interest-bearing liabilities for six months ended June 30, 2023 was 1.60% compared to 0.63% for six months ended June 30, 2022.
Interest expense on deposits increased $6.7 million, or 227.8%, to $9.6 million for the six months ended June 30, 2023 compared to $2.9 million for the six months ended June 30, 2022. The increase primarily was due to an increase in the average cost of deposits, specifically, money market accounts and certificates of deposit. The average rate paid on interest bearing deposits increased by 98 basis points to 1.37% for the six months ended June 30, 2023, compared to 0.39% for the six months ended June 30, 2022. The overall average cost of deposits for the six months ended June 30, 2023 and 2022 was 0.91% and 0.26%, respectively. The average balance of deposits totaled $1.4 billion for the six months ended June 30, 2023, compared to $1.5 billion for the same period in 2022, with decreases in the average balances of savings, NOW and money market accounts being offset by an increase in the average balance of certificates of deposit. The average balance of noninterest bearing deposits decreased $64.3 million, or 8.30%, to $709.6 million for the six months ended June 30, 2023 compared to $773.9 million for the same period in 2022.
Interest expense on borrowings increased $216,000, or 10.90%, to $2.2 million for the six months ended June 30, 2023, compared to $2.0 million for the six months ended June 30, 2022. The average balance of borrowings increased $609,000 to $72.6 million during the six months ended June 30, 2023, compared to $72.0 million during the six months ended June 30, 2022. The average cost of borrowings increased to 6.11% for the six months ended June 30, 2023, compared to 5.55% for the six months ended June 30, 2022.
Net interest income and net interest margin. Net interest income increased $1.1 million, or 4.8%, to $24.3 million for the three months ended June 30, 2023, compared to $23.2 million for the three months ended June 30, 2022. The increase in net interest income primarily was due to increases in interest income on loans, cash and cash equivalents and, to a lesser extent, investment securities, including dividends on FRB and FHLB stock, partially offset by higher funding costs related to increased rates of interest payable on our deposits and junior subordinated debentures.
The average yield (annualized) on interest earning assets for the three months ended June 30, 2023 increased to 5.18%, a 121 basis point increase from 3.97% for the three months ended June 30, 2022, while the average cost of interest bearing liabilities was 1.82% and 0.62% for the three months ended June 30, 2023 and 2022, respectively. The average yield (annualized) on interest earning assets for the six months ended June 30, 2023 increased to 5.15%, a 115 basis point increase from 4.00% for the six months ended June 30, 2022, while the average cost of interest bearing