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, of Middlefield Banc Corp. of our report dated March 13, 2025, relating to our audit of the consolidated financial statements and internal control over financial reporting, 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, 2024.
/s/S. R. Snodgrass, P.C.
Cranberry Township, Pennsylvania
March 13, 2025