Ever wondered what's behind that big long number that we call a "SteamID"? It isn't just random; there are actually four numbers packed into it.
A SteamID has four parts:
- Universe - The "instance of Steam" in which this ID is used. There is only one public Steam instance. Its name is "public", and its number is 1. The other universes are used internally at Valve for testing.
- Type - A SteamID can actually stand for several different types of accounts. The most common is individual, which is an individual user account. There are also types for clans (Steam groups), gameservers, anonymous gameservers, anonymous users, and more.
- Instance - This number is a bit finnicky. For the most part it's just a static number. For example, for individual SteamIDs the instance is pretty much always 1 (for desktop).
- Account ID - This is the actual ID of the account. Account IDs increment over time. If you know what universe, type, and instance an ID is for, then this is all you need to uniquely identify the account.
As I mentioned previously, a 64-bit SteamID is actually broken down into four parts:
- 8 bits for the universe
- 4 bits for the type
- 20 bits for the instance
- 32 bits for the account ID
This means that in order to get an account ID out of a 64-bit SteamID, all you need to do is
steamID & 0xFFFFFFFF.
Warning: The Steam WebAPI and Steam Community website actually don't care about the instance as long as you've set the type and universe correctly. This means that if you're taking user input for SteamIDs, you could end up with duplicate accounts. For example, the SteamIDs 76561198006409530 and 76561202301376826 are considered identical because the universe, type, and accountids are the same. Try it for yourself: https://steamcommuni...561198006409530 https://steamcommuni...561202301376826
Failure to take this into account can result in such exploits as this:
(Yes, those are actually the same Steam account)
Common SteamID Confusion
SteamID aspects are a common source of confusion. For starters, what do you call various SteamID formats?
- This is the 64-bit SteamID (or just SteamID) format: 76561198006409530
- This is the Steam3 format: [U:1:46143802]
- This is the Steam2 format: STEAM_0:0:23071901 (or the newer Steam2 format: STEAM_1:0:23071901)
The "partner ID" in trade offer URLs is actually the account's account ID.
Reading Rendered IDs
Here's how to interpret the rendered ID formats.
[T:U:A] or [T:U:A:I]
- T - This is a single letter (case-sensitive) which tells you what type of account this is. The characters are documented on the Valve developer wiki.
- U - This is the universe to which this SteamID belongs. Unless you work for Valve, this will always be 1.
- A - This is the account ID for this SteamID.
- I - This is the SteamID's instance number. May be omitted if the instance is the default for that ID type or can be determined in other ways.
The Steam2 rendered format can only be used for individual SteamIDs.
- X - This is the universe to which this SteamID belongs. Older games use 0 to stand for public, newer ones use 1.
- Y - This is the SteamID's accountid modulo 2.
- Z - This is the SteamID's accountid halved and rounded down.
Working with SteamIDs in code
If you're using Node.js, you can use node-steamid to parse, create, and deal with SteamIDs.
If you're using PHP, you can use php-steamid.
If you're using C#, SteamKit has a SteamID class.
Edited by Dr. McKay, 27 August 2018 - 11:14 PM.