The question was not originally clear if you wanted [tags][1] or [badges][2], but the answer is the same...

To just get totals, use [the `total` filter][3].  
For example, **for badges**: [/badges?site=stackoverflow&filter=total][4], which currently returns:

    {"total":6363}

**For tags**: [/tags?site=stackoverflow&filter=total][5], which currently returns:

    {"total":48667}

###WARNING:
In practice, the `total` filter is dangerous, because it masks errors, warnings and `backoff` intervals.  
So, in practice use `!w-*Ytm8YGWVl9..xoC` instead of `total`, per: https://stackapps.com/questions/7829/my-filter-is-not-returning-any-results-how-to-create-a-minimal-filter.


----------
If you want both the badges/tags *and* the total, you can set a custom filter, or just count the members of the `items` array as you page through them.  The latter option is less expensive in the API and thus less likely to get you [`backoff` warnings][6].

Note that you can set the pagesize up to 100.  See [the doc page for tags][7], for example.


----------

----------
**IMPORTANT:** [The *Tags* page][1] also shows [synonyms][8] and also a great many tags that have zero questions.  
The API /tags route , however, returns neither of these, as best as I can tell<sup>&ddagger;</sup>. (3 or 4 very recently orphaned tags being the exception).  So the totals will not match up.


----------
<sup>&ddagger;</sup><sub>EG, currently [Stack Apps only has 7 synonyms][9].  Confirmed that none of those show in [the /tags route][10], but all show on [the Tags pages][11].  Likewise, the only [zero count tag in the API][12] is currently the *featured* tag, which is moderator only.</sub>


  [1]: https://stackoverflow.com/tags
  [2]: https://stackoverflow.com/help/badges
  [3]: https://api.stackexchange.com/docs/filters
  [4]: https://api.stackexchange.com/2.2/badges?site=stackoverflow&filter=total
  [5]: https://api.stackexchange.com/2.2/tags?site=stackoverflow&filter=total
  [6]: https://api.stackexchange.com/docs/wrapper
  [7]: https://api.stackexchange.com/docs/tags#pagesize=100&site=stackoverflow
  [8]: https://meta.stackexchange.com/tags/tag-synonyms/info
  [9]: https://stackapps.com/tags/synonyms
  [10]: https://api.stackexchange.com/docs/tags#pagesize=100&order=asc&sort=name&filter=default&site=stackapps&run=true
  [11]: https://stackapps.com/tags
  [12]: https://api.stackexchange.com/docs/tags#pagesize=100&order=asc&sort=popular&filter=default&site=stackapps&run=true