Skip to content

Instantly share code, notes, and snippets.

@aligatorr89
Last active February 1, 2024 14:34
Show Gist options
  • Save aligatorr89/eccdd4352bf0055ca8d347c01b3044bd to your computer and use it in GitHub Desktop.
Save aligatorr89/eccdd4352bf0055ca8d347c01b3044bd to your computer and use it in GitHub Desktop.
Convert SteamID3 to SteamID64 - Javascript
// Convert SteamID3 to SteamID64
// Use big js for precision with big numbers
const Big = require('big.js');
/*
* Example: '[U:1:927695233]' -> '76561198887960961'
* https://www.steamidfinder.com/lookup/U%3A1%3A927695233/
*/
function convertSteamId3ToSteamId64(steamId3) {
const accountId = steamId3.replace('[', '').replace(']', '').split(':')[2];
// 76561197960265728 is Valve's magic constant
return Big(accountId).plus('76561197960265728').toString();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment