Exhibit 5.1

                        [ON BARLEY SNYDER LLC LETTERHEAD]


                                                          June 21, 2005



QNB Corp.
15 North Third Street
Quakertown, PA 18951-9005

         Re:      FORM S-8 REGISTRATION STATEMENT

Dear Ladies and Gentlemen:

         We have acted as counsel to QNB Corp. ("QNB") in connection with the
registration under the Securities Act of 1933, as amended, by means of a
registration statement on Form S-8 (the "Registration Statement"), of 200,000
shares of the $0.625 par value common stock of QNB ("Common Stock"), to be
issued upon exercise of options (the "Options") granted by QNB pursuant to its
2005 Stock Incentive Plan (the "Plan"). The Registration Statement also
registers an indeterminate number of additional shares which may be necessary to
adjust the number of shares registered thereby for issuance as the result of a
stock split, stock dividend or similar adjustment of the outstanding Common
Stock.

         This Opinion Letter is provided pursuant to the requirements of Item
601(b)(5)(i) of Regulation S-K of the Securities and Exchange Commission for
inclusion as an exhibit to the Registration Statement.

         This Opinion Letter is governed by, and shall be interpreted in
accordance with, the Legal Opinion Accord (the "Accord") of the American Bar
Association's Section of Business Law (1991), as supplemented or modified by the
Pennsylvania Third-Party Legal Opinion Supplement (the "Pennsylvania
Supplement") of the Pennsylvania Bar Association's Section of Corporation,
Banking and Business Law (1992). As a consequence, this Opinion Letter is
subject to a number of qualifications, exceptions, definitions, limitations on
coverage and other limitations, all as more particularly described in the Accord
and the Pennsylvania Supplement, and this Opinion Letter shall be read in
conjunction therewith. The Law covered by the opinions expressed herein is
limited to the federal law of the United States of America and the law of the
Commonwealth of Pennsylvania. Except as otherwise indicated herein, capitalized
terms used in this Opinion Letter are defined and set forth in the Accord or the
Pennsylvania Supplement. Our opinions herein are subject to the following
conditions and assumptions, in addition to those set forth in the Accord and the
Pennsylvania Supplement:

         (1) The shares of Common Stock issuable pursuant to the exercise of the
Options will continue to be validly authorized on the dates the Common Stock is
issued pursuant to the exercise of the Options;

         (2) On the dates the Options are exercised, the Options will constitute
valid, legal and binding obligations of QNB and will (subject to applicable
bankruptcy, moratorium, insolvency, reorganization and other laws and legal
principles affecting the enforceability of creditors' rights generally) be
enforceable as to QNB in accordance with their terms;

         (3) No other change occurs in applicable law or the pertinent facts;
and

         (4) The provision of "blue sky" and other securities laws as may be
applicable have been complied with to the extent required.



<page>

         Based upon and subject to the foregoing, and subject to the assumptions
set forth herein, we are of the opinion that the shares of Common Stock to be
issued pursuant to the exercise of the Options have been duly authorized and,
upon receipt by QNB the consideration required thereby, will be legally issued,
fully paid and nonassessable.

         We hereby consent to the filing of this opinion as an exhibit to the
Registration Statement.

                                                   Very truly yours,

                                                   /s/ Barley Snyder LLC
                                                   ---------------------