---
title: "Count Tokens"
description: "Local-first visual environment for building and running AI workflows. Build agents visually, deploy anywhere, privacy by design."
canonical: https://docs.nodetool.ai/nodes/nodetool/text/counttokens
markdown: https://docs.nodetool.ai/nodes/nodetool/text/counttokens.md
product: NodeTool
source: https://github.com/nodetool-ai/nodetool/blob/main/docs/nodes/nodetool/text/counttokens.md
---

# Count Tokens

**Type:** `nodetool.text.CountTokens`

**Namespace:** `nodetool.text`

## Description

Counts the number of tokens in text using tiktoken.
    text, tokens, count, encoding

## Properties

| Property | Type | Description | Default |
|----------|------|-------------|---------|
| text | `str` |  | `` |
| encoding | `enum` | The tiktoken encoding to use for token counting | `cl100k_base` |

## Outputs

| Output | Type | Description |
|--------|------|-------------|
| output | `int` |  |

## Related Nodes

Browse other nodes in the [nodetool.text](./) namespace.
