---
url: >-
  /statelake/scripting-reference/functions-and-procedures/conversion-functions/inttobin.md
---

# IntToBin

The function **IntToBin** converts an **Integer** value into a **String** of binary digits (i.e. a series of 0's and 1's).

The parameter **d** specifies the number of digits in the **String** - if **d** is too small to represent all of the binary digits, then a system error will occur.

Declaration: Function IntToBin( v : LongInt; d : integer) : string

The example.

```pascal
procedure OnMapEvent(var Value:Variant);
var
  MyAmount, My2ndAmount : Integer;
begin
  My1stAmount := 123;
  My2ndAmount := 5677;
  LogInfo(IntToBin(My1stAmount, 10));       // outputs 0001111011
  LogInfo(IntToBin(My2ndAmount, 15))        // outputs 001011000101101
end;
```

Please also review [IntToBin2](/statelake/scripting-reference/functions-and-procedures/conversion-functions/inttobin2).
