Tag Archives: keysafe

List of 4 Digit Lock Box Combinations

A lock box or key safe is used to store the key to a door in a semi-secure fashion. In the type shown here, the box is opened by pushing exactly the correct digits, then sliding a lever to open. If the wrong combination is entered, the lock must be reset before trying again. On this type of lock, the order of the digits does not matter; i.e., the combination 3924 is the same as 2349.

The combination can be any number of digits up to 10, but most people use a 4-digit combination. Below is a list of possible combinations for such a lock.

0123
0124
0125
0126
0127
0128
0129
0134
0135
0136
0137
0138
0139
0145
0146
0147
0148
0149
0156
0157
0158
0159
0167
0168
0169
0178
0179
0189
0234
0235
0236
0237
0238
0239
0245
0246
0247
0248
0249
0256
0257
0258
0259
0267
0268
0269
0278
0279
0289
0345
0346
0347
0348
0349
0356
0357
0358
0359
0367
0368
0369
0378
0379
0389
0456
0457
0458
0459
0467
0468
0469
0478
0479
0489
0567
0568
0569
0578
0579
0589
0678
0679
0689
0789
1234
1235
1236
1237
1238
1239
1245
1246
1247
1248
1249
1256
1257
1258
1259
1267
1268
1269
1278
1279
1289
1345
1346
1347
1348
1349
1356
1357
1358
1359
1367
1368
1369
1378
1379
1389
1456
1457
1458
1459
1467
1468
1469
1478
1479
1489
1567
1568
1569
1578
1579
1589
1678
1679
1689
1789
2345
2346
2347
2348
2349
2356
2357
2358
2359
2367
2368
2369
2378
2379
2389
2456
2457
2458
2459
2467
2468
2469
2478
2479
2489
2567
2568
2569
2578
2579
2589
2678
2679
2689
2789
3456
3457
3458
3459
3467
3468
3469
3478
3479
3489
3567
3568
3569
3578
3579
3589
3678
3679
3689
3789
4567
4568
4569
4578
4579
4589
4678
4679
4689
4789
5678
5679
5689
5789
6789

Three are 210 possible combinations, meaning that it would take someone about half an hour to hack such a lock simply by trying numbers from the list. Some combinations are more likely, such as 1234, the house number, or an important year, but that’s beyond the scope of this article.

The code below was used to generate the list. It could easily be modified to generate a list of all 1024 possible combinations. Also, some lock boxes have an additional # and * key, like a telephone keypad. A list of combinations could be generated for such a lock by changing nButtons to 10 and MaxCombos to 4096. Note that the additional keys would print as hexadecimal A and B, which you would map to the extra keys.

//  This quick program will calculate the possible combinations
//  for a 10-digit lockbox.  Order of the digits does not matter,
//  and no digit may be repeated.
//  To compile
//    gcc combo.c -o combo
//  Roderick; 26-AUG-2025.
#include <stdio.h>

#define nButtons 10
//#define MaxCombos (2^nButtons)
#define MaxCombos 1024

int main() {
	int ComboNumber;  // Combination #1, #2, #3, etc.
	int OutputLineNumber = 1;

	for (ComboNumber=0; ComboNumber<MaxCombos; ComboNumber++) {
		int n, nDigits, tComboNumber;

		tComboNumber = ComboNumber;

		// see if we have a 4-digit combination
		nDigits = 0;
		for (n=0; n<nButtons; n++) {
			if (tComboNumber & 1) nDigits++;
			tComboNumber >>= 1;
			}

		// if the combination is not 4 digits, we're not interested
		// if we are interested in all combinations regardless of
		// digit count, take out this condition
		if (nDigits == 4) {

			tComboNumber = ComboNumber;

			// DEBUG printf("Combo #%d: ", ComboNumber); 
			// DEBUG printf("%d. ", OutputLineNumber);

			for (n=0; n<nButtons; n++) {
				if (tComboNumber & 1) printf("%1X", n);
				tComboNumber >>= 1;
				}
			printf("\n");
			OutputLineNumber++;
			}
		}
}