Exhibit 23
CONSENT OF INDEPENDENT REGISTERED PUBLIC ACCOUNTING FIRM
We consent to the incorporation by reference in Registration Statements File No. 333-213607 and 333-219313 on Form S-3; File No. 333-218859 on Form S-8; and File No. 333-183497 on Form S-3D and Form S-3DPOS, effective September 13, 2012, of Middlefield Banc Corp. of our report dated March 15, 2023, relating to our audit of the consolidated financial statements, which appears in the Annual Report to Stockholders, which is incorporated in this Annual Report on Form 10-K of Middlefield Banc Corp. for the year ended December 31, 2022.
/s/S. R. Snodgrass, P.C.
Cranberry Township, Pennsylvania
March 15, 2023