# tokenizers — card for AI agents

Fast NLP tokenizer library by Hugging Face for text processing.

Category: Prompts, structured output and evals · PyPI package `tokenizers` · latest version 0.23.3 (checked 2026-11-01)
Install: `pip install tokenizers`
License: Apache-2.0 (permissive)

In your own product (generator, app, hosted service): **yes**. Permissive license: ship it inside your own product, closed or open source, and keep its license and copyright notice.

## Rules for AI agents (paste into AGENTS.md or CLAUDE.md)

## tokenizers
- Check whether the project pins the 0.23 line (latest release v0.23.3) or the v1 candidate. The candidate installs with `pip install --pre tokenizers`.
- Load tokenizers with `Tokenizer.from_pretrained("")` or `Tokenizer.from_file(path)`. Read ids from the returned `Encoding`.
- On v1 rc0, do not write code that trains, builds from components, edits or saves a tokenizer. The docs say these are not exposed yet.
- If `huggingface_hub` v2 is in the environment, use tokenizers v0.23.3 or later. That release loosened the requirement.
- In Rust, depend on the umbrella `tokenizers` crate unless you know you want less.
- For wasm32 builds, enable the `simd128` target feature. Without it, the scalar path is used.

## Docs written for agents
- [llms.txt (index of the docs)](https://huggingface.co/docs/tokenizers/llms.txt)

## What it is
- tokenizers is Hugging Face's tokenization library, created in 2019 and licensed Apache-2.0. The Rust crate is the reference implementation. Python and Node.js bindings sit on top of it, and the docs say these tokenizers are also used in Transformers. It covers the BPE, Unigram, WordPiece and WordLevel models. Text passes through a pipeline of normalizer, pre-tokenizer, model, post-processor and decoder.
- The project is moving from 0.23 to v1.0.0, and the README is written around a release candidate. The core is split into sub-crates. `tk-encode` is the inference engine. `tk-train` holds training. `tk-serialize` reads `tokenizer.json`. `tk-convert` upgrades legacy configs. `bitcannon` does pre-tokenization. The README says this lets a serving binary skip everything it does not use.
- It suits developers who need to load a published `tokenizer.json` and encode or decode text. If you also want to train or edit tokenizers, check which release you are on: the docs say the rc0 bindings do not yet expose those features.

## Caveats
- The v1 release candidate is missing features: The docs say rc0 only loads a `tokenizer.json`, encodes and decodes. Building a tokenizer from components, editing it, saving it and training are not exposed yet.
- Breaking changes in the move to 1.0: The maintainers say they introduced breaking changes in the switch from 0.23. They plan to describe them in a blog post that is not yet published. Installing the candidate needs `pip install --pre tokenizers`.
- Known load failure for some models: The Rust core roadmap lists an open fix for ModernBERT and OLMo tokenizers, which fail to load with a "64-bit hash collision". Offset tracking and windowing are also still on the list.
- Patch churn on the 0.23 line: v0.23.3 fixed a breaking change from 0.23.1 in truncation and overflowing. It also loosened the `huggingface_hub` pin, which the release notes say unblocks `transformers` installs.
- Only Rust, Python and Node today: C and C++ bindings are on the v1 roadmap. Java, Go and Swift come after 1.0 and will be built on the C bindings. Ruby support lives in a community repo.

## Numbers (AgentGid data)
- Gid Score: 76.7 (#167 of all tools, 2 of 78 in its category)
- Used in 25 public projects set up for AI coding agents (0.4%)
- Downloads last week: 55,555,157 (as of 2026-11-24), +15.5% over 4 weeks
- GitHub stars: 11,291 (as of 2026-11-24)
- Last push: 2026-11-23

## Often used with
NumPy 100.0%, PyYAML 92.0%, Hugging Face Hub 88.0%, Pydantic 84.0%, tqdm 84.0%, charset-normalizer 80.0%

## Checked alternatives (same job)
- tiktoken (Python): https://agentgid.com/tools/tiktoken-pypi/agent.md
- SentencePiece: https://agentgid.com/tools/sentencepiece/agent.md

## Links
- AgentGid page: https://agentgid.com/tools/tokenizers/
- Homepage: https://github.com/huggingface/tokenizers
- Repository: https://github.com/huggingface/tokenizers
- Source: https://github.com/huggingface/tokenizers#readme
- Source: https://github.com/huggingface/tokenizers
- Source: https://github.com/huggingface/tokenizers/releases
- Source: https://huggingface.co/docs/tokenizers

---
AgentGid's catalog is curated: every entry was checked against the maker's official pages (registry, repository, license and pricing pages) on the date shown; a license value shows the quote it stands on wherever AgentGid has one. Usage numbers come from AgentGid's own scan of public repositories set up for AI coding agents. Claims by makers are reported, not tested by AgentGid.
