Skip to the tool

Tool

Wrap a chat template and count tokens

Published ChatML, Llama 3, Gemma, and Qwen wrapper strings are prepended to the messages. The token number is encode() of that wrapped string with o200k or cl100k, not a GPT-6 vocabulary.

Wrapping and encode() run in this tab. Tokenizer rank files load from this site into the browser. GearDel does not receive the paste.

What is concatenated

The box is parsed as OpenAI messages, a messages array, ShareGPT conversations, Alpaca instruction/output, or a bare user sentence. Only the first JSON value is wrapped if you paste JSONL.

ChatML and Qwen use the published <|im_start|>role / <|im_end|> lines. Qwen does not add a vendor system prompt here.

Llama 3 uses <|begin_of_text|>, <|start_header_id|>role<|end_header_id|>, and <|eot_id|> as commonly shown on instruct cards.

Gemma IT uses <bos>, <start_of_turn>user|model, and <end_of_turn>. System text is prepended to the first user turn. assistant is written as model.

The generation checkbox appends the next-turn header with no assistant text. Token count is js-tiktoken encode() of the concatenated string with o200k_base or cl100k_base — the same encodings as the token-count page. That is not a Llama, Gemma, or GPT-6 vocabulary.

What this page does not do

  • It does not register <|im_start|> or Llama special tokens in tiktoken. encode() may split those strings. A model tokenizer can map them to one ID.
  • It does not implement Claude, Gemini, or a Korean-only SentencePiece tokenizer.
  • Tool calls, image parts, and Hugging Face apply_chat_template Jinja are out of scope.
  • The wrap is capped at 200,000 code points for encode().

Messages

Published ChatML strings: <|im_start|>role newline content<|im_end|>

js-tiktoken maps GPT-4o, GPT-4.1, o1, o3, o4-mini, and GPT-5 to o200k_base. No chat template is added.

Messages parsed
0
Wrapped code points
0
Tokens of wrapped string
—

encode() runs on the wrapped string. Markup such as <|im_start|> is not registered as special tokens on this page, so BPE may split it. A model tokenizer can map that string to one ID.

Questions

Why is this larger than the token-count page?

That page encodes the paste with no chat markup. This page concatenates published wrapper strings first, then encodes. The wrappers themselves take tokens under cl100k/o200k.

Does this match llama.cpp or vLLM?

Only the visible wrapper text is copied from common public templates. Serving stacks may add BOS, a default system prompt, or special-token IDs this page does not assign.

Does GearDel store the chat?

No. Rank files load into the browser. The paste is not uploaded.

Related on GearDel

Pick a Korean dataset by task →

Korean LLM training rows →

Alpaca vs ShareGPT vs messages →

Eval sets vs training rows →

All browser tools →