Exhibit 23.1

CONSENT OF INDEPENDENT REGISTERED PUBLIC ACCOUNTING FIRM

We hereby consent to the incorporation by reference in the following Registration Statements:

| (i) | Registration Statements on Form S-8 (Nos. 333-216492, 333-209998, 333-202709, 333-194634, 333-187206 and 333-180334) pertaining to the 2011 Equity Incentive Plan,

| (ii) | Registration Statements on Form S-8 (Nos. 333-209998 and 333-180334) pertaining to the 2011 Equity Incentive Plan and 2011 Employee Stock Purchase Plan,

| (iii) | Registration Statement on Form S-8 (No. 333-172409) pertaining to the 2006 Stock Plan, 2011 Equity Incentive Plan and 2011 Employee Stock Purchase Plan, and

| (iv) | Registration Statement on Form S-3 (No. 333-218506).

of our reports dated March 8, 2018, with respect to the consolidated financial statements and the effectiveness of internal control over financial reporting of AcelRx Pharmaceuticals, Inc. included in this Annual Report on Form 10-K of AcelRx Pharmaceuticals, Inc. for the year ended December 31, 2017.

/s/ OUM & CO. LLP

San Francisco, California

March 8, 2018