# How to Calculate Steam ID for Non-Steam Games using JavaScript

#### tl;dr:

```
const target = '"C:\\Program Files (x86)\\Origin\\Origin.exe"';
const label = 'Fubar Game';
const top32 = BigInt.asUintN(32, BigInt(require('crc').crc32(target + label)));
const bottom32 = 0x02000000n;
const steamId = (top32 << 32n) | bottom32;
```

Note: You can remove the Node.js dependency on the `crc`

package by replacing `require('crc').crc32(...)`

with any CRC32 implementation (example).

The Steam ID is a 64-bit unsigned integer. The top 32 bits are the CRC32 checksum of the concatenated target and label UTF-8 encoded strings. The bottom 32 bits are the constant `0x02000000`

. So all you have to do is concat the strings, calculate the checksum, shift left 32 bits, and set the constant bits.

We cast everything to BigInt because JavaScript numbers cannot accurately represent 64-bit integers. We use `BigInt.asUintN(32, ...)`

to ensure the checksum is an unsigned 32-bit integer (some CRC32 implementations return negative numbers).

The values of the target and label strings should exactly match the values in the Steam UI (include double quotes if and only if they appear in Steam).