---
title: std.itoa_charset
summary: null
url: >-
  https://www.fastly.com/documentation/reference/vcl/functions/strings/std-itoa-charset
---

```
STRING std.itoa_charset(INTEGER value, STRING charset)
```

**Available in:** all subroutines

Converts the integer `value` to a string in the character set
`charset`.

The `charset` value must be at least two characters in length. The length of the
character set is the numeric base of the conversion, so "0123456789ABCDEF"
converts to base 16 (hexadecimal) using uppercase
letters. Repeated characters are permitted.

Base prefixes, such as hexadecimal (`0x`) and octal (`0`), are not
included.

## Errors

If the `charset` argument is _not set_ or has fewer than two characters,
then `fastly.error` will be set to `EINVAL`.

## Example

```vcl
# binary, but sheep: "baaa"
std.itoa_charset(8, "ab")

# hexadecimal in uppercase: "DEADBEEF"
std.itoa_charset(0xdeadbeef, "0123456789ABCDEF")

# arbitrary Base62, sometimes used for URL-safe encoding: "5KsxueeBfd8"
std.itoa_charset(4825434263756878946, "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
```
