---
url: >-
  https://adk.nht.io/api/@nhtio/adk/batteries/tools/encoding/variables/encodeTextTool.md
description: >-
  Encode or decode text using common schemes: base64, url (percent-encoding),
  html_entities.
---

# Variable: encodeTextTool

```ts
const encodeTextTool: Tool<SpooledArtifact>;
```

Defined in: [batteries/tools/encoding/index.ts:37](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/batteries/tools/encoding/index.ts#L37)

Encode or decode text using common schemes: base64, url (percent-encoding), html\_entities.

## Remarks

`base64` uses the portable `globalThis.btoa`/`atob` pair so the tool works in browsers, Node,
and edge runtimes. Encoding/decoding errors are returned as `Error:` strings rather than
thrown so the model can react in-line.
