Drag minesweeper screenshots here to parse into this website. This will overwrite the board.

Note: It may predict tiles incorrectly, so you will have to check your screenshot once it has been parsed.

You will have to crop only the minesweeper board and input the width for the tiles to be processed correctly.


About
Calculate Probability Shift+Enter
Results
Clear Results



Parse Minesweeper Screenshot





Clear All Tiles Shift+Delete
Minesweeper Patterns
Math Explanation
GitHub Source
Close

Fractions or percentages equaling 0 or 0% (green) is guaranteed to be a safe number tile, and 1 or 100% (red) is guaranteed to be a mine.

Only tiles that are near number tiles (sides and diagonally) will have their probability calculated.

The web app calculates the probability by first gathering all the tiles that are near number tiles, assigning id numbers for each unique tile, and createing a system of equations of each number tile using the ids.

The web app will attempt to solve the equations in order to find all possible solutions.

For each valid solution, each id number is assigned 0 (no mine) or 1 (mine).

The probability is calculated depending on the option that you have chosen (Local or Global Probability).

See the Results tab to see an example of the matrix calculations in action, and the number of solutions.

Note: If you recalculate the same board, the data of the calculation will not be changed, meaning that you can see Local / Global Probability calculations from the same board without waiting for the calculation to complete multiple times.

Once the probability is calculated, you can click on adjacent tiles to see the calculations of the total number of solutions, and the frequency of solutions s that have m number of mines. This shows the frequencies per tile and per board/system.

You can also check the possible mine configurations or valid solutions by checking the Solutions checkbox. This will try to show every single mine configuration possible for a particular subsystem or subboard. Configurations are ordered from least to greatest amount of mines. To see the range for each exact number of mines for a Configuration, see the 'Results' tab.

This website can also parse screenshots of minesweeper boards. To try this feature, drag a minesweeper screenshot, input the width of the board and crop only the board available, and press 'Parse Screenshot'.
Note: If you properly cropped the picture, it may still be inaccurate in its predictions, so you will have to check your screenshot for any incorrect tiles.
Close
I have used the page https://www.lrvideckis.com/blog/2020/07/17/minesweeper_probability.html as research to help calculate and explain the probabilities.

There are two types of probability in this calculator: Local and Global.
Local calculates only the adjacent tiles near number tiles, and it does not consider any mines that would be in non-adjacent tiles.
Global calculates all unknown tiles. Most minesweeper games have a global mine count, and it not only influence the probability for non-adjacent tiles, but it also affects probability for adjacent tiles as well.
This page describes the formula used to calculate them.

To give an example on how to calculate them, consider this 5x5 board.

There are 14 possible solutions as shown below.

Local Probability

To calculate the Local probability, simply count the number of mines per tile for each solution. Then divide by the number of solutions.
For the variables \( S \), a solution array of unknown tiles, in a solution array set \( SS \) s.t. \[ \forall i \in \{0, 1, \dots, n-1\},\quad S[i] \in \{0, 1\} \] and a tile number \( T \) s.t. \[ T \in \{0, 1, \dots, |SS|-1\} \] Then the local probability is calculated as \[ \text{LocalProbability}(T) = \frac{ \displaystyle \sum_{ S \in SS } S[T] }{ |SS| } \] For a calculation example, let's say the tile numbers are numbered from 0 to \( |S| \) as shown below.
Note that |S| is the same as the number of unknown adjacent tiles near number tiles only.
\[ \begin{aligned} \text{LocalProbability}(0) &= \frac{ 2 }{ 14 }\\ \text{LocalProbability}(1) &= \frac{ 3 }{ 14 }\\ \text{LocalProbability}(2) &= \frac{ 1 }{ 14 }\\ \text{LocalProbability}(3) &= \frac{ 3 }{ 14 }\\ \text{LocalProbability}(4) &= \frac{ 2 }{ 14 }\\ \dots \end{aligned} \] It should be noted that for any \( T \), \[ \text{LocalProbability}(T) = 100\% \text{ (guaranteed mine)} \] \[ \text{ only if } \displaystyle \sum_{ S \in SS } S[T] = |SS| \] \[ \text{LocalProbability}(T) = 0\% \text{ (guaranteed safe)} \] \[ \text{ only if } \displaystyle \sum_{ S \in SS } S[T] = 0 \]

Global Probability (Adjacent Tiles)

To calculate the global probability of adjacent, the global mine count as \( M_G \) is considered, including the number of mines for each solution array \( S \) in a solution set \( SS \).
Here are also other variables to define: \[ \begin{array}{l} U_A \text{ as number of all adjacent tiles},\\ \text{where }U_A=|S|,\\ U_{NA} \text{ as number of non-adjacent unknown tiles}, \end{array} \]
Note that there are 12 solutions which have 2 mines, and 2 solutions which have 1 mine in the 5x5 1-1-1 board.
Let's describe a map function that maps each number of mines to its number of occurances. \[ \begin{array}{l} MF_t : \text{ℤ}_{\ge 0} \rightarrow \text{ℤ}_{\ge 0}\\ MF_t(m) = n,\\ m \text{ as number of mines},\\ n \text{ as number of occurances},\\ MF_t(m) = \begin{cases} n_0 & \text{if } m = m_0 \\ n_1 & \text{if } m = m_1 \\ n_2 & \text{if } m = m_2 \\ \dots \\ 0 & \text{otherwise} \end{cases} \end{array} \] Then mapping the solutions of mines to occurances to a function \( MF_G(m) \) is then \[ MF_G(m) = \begin{cases} 2 & \text{if } m = 1 \\ 12 & \text{if } m = 2 \\ 0 & \text{otherwise} \end{cases} \] Let's also describe a set \( S_M = \{ m_0, m_1, m_2, \dots \}\) for the set of the number of mines in the solution set. \[ S_{M_G} = \{ 1,2 \} \]
The reason why the number of mines and the occurances are considered is because the leftover mines, e.g. \( M_G - m_n \), are arranged in a combination of all non-adjacent tiles \( U_{NA} \). We'll use this number and the function \( MF_G \) to create the sample space for the formula for adjacent tiles, or \( \text{GlobalProbability}_A(T) \).
The formula to count all combinations above is \( \binom{U_{NA}}{M_G - m_n} \).
For example, there are 10 non-adjacent tiles from the 5x5 board below written as N.
Let's say we have a global mine count \( M_G = 4 \), and counting \( m = 2 \) from a solution. There would be \( M_G - m = 4 - 2 = 2\) mines left over. The mine combinations would be shown as the following

...and so forth.
The number of combinations would be \[ \binom{U_{NA}}{M_G - m_n} = \binom{10}{4 - 2} = \binom{10}{2} = 45\]
The formula of the sample space, or denominator, for \( \text{GlobalProbability}_A(T) \) is \[ \displaystyle \sum_{ m \in S_{M_G} } MF_G(m) \cdot \binom{U_{NA}}{M_G - m} \] This formula enumerates each number of occurances of each number of mines from the solution set, and multiplies the leftover mine combination \( \binom{U_{NA}}{M_G - m_n} \) as the "weighted sum" for each \( m \in S_{M_G} \).
To find the numerator for each adjacent tile, we use the same formula above to get the number of mines, the occurances, and the leftover mine combinations but counting only if \( S[T] = 1 \) as from the Local Probability.
For example, for tile 0, \[ \begin{array}{l} MF_0(m) = \begin{cases} 2 & \text{if } m = 2 \\ 0 & \text{otherwise} \end{cases}\\ \text{ and } S_{M_0} = \{ 2 \} \end{array} \] This describes that only 2 solutions have this tile as a mine, and those solutions have 2 mines.
For tile 1, \[ \begin{array}{l} MF_1(m) = \begin{cases} 3 & \text{if } m = 2 \\ 0 & \text{otherwise} \end{cases}\\ \text{ and } S_{M_1} = \{ 2 \} \end{array} \] This describes that only 3 solutions have this tile as a mine, and those solutions have 2 mines.
For tile 2, \[ \begin{array}{l} MF_2(m) = \begin{cases} 1 & \text{if } m = 1 \\ 0 & \text{otherwise} \end{cases}\\ \text{ and } S_{M_2} = \{ 1 \} \end{array} \] This describes that only 1 solution has this tile as a mine, and that solution only has 1 mine.
...and so forth.
It should be noted that \( \forall S_{M_n}, S_{M_n} \sub S_{M_G} \), meaning that tiles may or may not contain all number of mines from \( S_{M_G} \).
The whole formula to get the global probability for adjacent tiles is. \[ \text{GlobalProbability}_A(T) = \frac{ \displaystyle \sum_{ m_T \in S_{M_T} } MF_t(m_T) \cdot \binom{U_{NA}}{M_G - m_T} }{ \displaystyle \sum_{ m \in S_{M_G} } MF_G(m) \cdot \binom{U_{NA}}{M_G - m} } \] It should be noted that for guaranteed safe and mine tiles, \[ \begin{array}{l} \text{If } M_T = \empty,\\ \text{then } \text{GlobalProbability}_A(T) = 0 \end{array} \] \[ \begin{array}{l} \text{If } MF_T(m) = MF_G(m) \text{ } \forall m,\\ \text{then } \text{GlobalProbability}_A(T) = 1 \end{array} \]

Global Probability (Non-Adjacent Tiles)

To get the probability for a non-adjacent tile, we consider the weight for each number of leftover mines, where the weight is \( MF_G(m) \), and the number of combinations of leftover mines. The number of combinations of leftover mines is described below. \[ \displaystyle \sum_{ m \in S_{M_G} } \binom{U_{NA}}{M_G - m} \] To check the number of combinations for a tile that has a mine, let's check some mine combinations again for \( m = 2 \) and \( M_G = 4 \), but only considering the top-left tile (marked as a flag).
It seems that there are 9 combinations out of \( \binom{10}{2} = 45 \) that is a mine while the rest is not a mine.
To get this number 9, or getting a formula for counting combinations of any non-adjacent tile that have a mine for \( \binom{U_{NA}}{M_G - m} \) combinations, we can fix one specific tile we are choosing, and find the number of combinations of all non-adjacent tiles - 1 with leftover \( M_G - m \) - 1 mines, or \( \binom{U_{NA} - 1}{M_G - m - 1} \). It shows that \( \binom{9}{1} = 9 \).

Let's also check \( m = 1 \). Using the formula, there are \( \binom{U_{NA}}{M_G - m} = \binom{10}{3} = 120 \text{ combinations}\) and \( \binom{U_{NA} - 1}{M_G - m - 1} = \binom{9}{2} = 36 \text{ combinations that have a mine in any tile.}\)

The probability of a non-adjacent tile is a mine would be the following with simplifications: \[ \begin{aligned} \frac{ \binom{U_{NA}-1}{M_G-m-1} }{ \binom{U_{NA}}{M_G-m} } &= \frac{ \binom{a-1}{b-1} }{ \binom{a}{b} } \text{, } a=U_NA \text{, } b=M_G-m \\ &= \frac{ \frac{ (a-1)! }{ (b-1)!(a-1-b+1)! } }{ \frac{ a! }{ b!(a-b)! } } \\ &= \frac{ \frac{ (a-1)! }{ (b-1)!(a-b)! } }{ \frac{ a \cdot (a-1)! }{ b \cdot (b-1)!(a-b)! } } \\ &= \frac{ 1 }{ \frac{a}{b} } \\ &= \frac{ b }{ a } \\ &= \frac{ M_G - m }{ U_{NA} } \\ \end{aligned} \] We need to also multiply the weight of each mine combination, where the numerator is the number of solutions per mines, or \( MF_G(m) \). The denominator of the weight would be the sum of all \( MF_G(m) \)

Thus, the formula of global probability for non-adjacent tiles is the following. \[ \text{GlobalProbability}_{NA} = \frac{ \displaystyle \sum_{ m \in S_{M_G} } (M_G-m) \cdot MF_G(m) }{ U_{NA} \cdot ( \displaystyle \sum_{ m' \in S_{M_G} } MF_G(m') ) } \]

Global Probability, where only some solutions are valid

Not all solutions may fit if there are too many or too little global mine counts given.

For example, what happens if the global mine count \( M_G \) is just 1? This means that there can only be 2 solutions that are valid that have 1 mine, and the 12 solutions that have 2 mines are simply discarded.

Also, what happens if the global mine count is greater than the number of mines \( m \) that would not fit for all non-adjacent tiles provided (e.g. \( M_G \gt m + U_{NA} \))? Then any solutions that cannot fit all leftover mines to non-adjacent tiles are also discarded. This would happen if \( M_G \) is 12. The 12 solutions from \( m = 2 \) is kept, and the 2 solutions for \( m = 1 \) would be discarded.

Considering these edge cases changes the probability depending on the global mine count.
And thus, \( \text{GlobalProbability}_A(T) \) can be rewritten as the following. \[ \frac{ \displaystyle \sum_{ m_T \in S_{M_T} \text{ | } m_T \le M_G \text{ and } M_G \le m_T + U_{NA} } MF_T(m_T) \cdot \binom{U_{NA}}{M_G - m_T} }{ \displaystyle \sum_{ m \in S_{M_G} \text{ | } m \le M_G \text{ and } M_G \le m + U_{NA} } MF_G(m) \cdot \binom{U_{NA}}{M_G - m} } \]
The boundaries also affect the probability of non-adjacent tiles as well, affecting the probability and weight sum calculations. \[ \text{GlobalProbability}_{NA} = \frac{ \displaystyle \sum_{ m \in S_{M_G} \text{ | } m \le M_G \text{ and } M_G \le m + U_{NA} } (M_G-m) \cdot MF_G(m) }{ U_{NA} \left( \displaystyle \sum_{ m' \in S_{M_G} \text{ | } m' \le M_G \text{ and } M_G \le m' + U_{NA} } MF_G(m') \right) } \] Note, that if the global mine count is less than all known solution mine numbers, then the program will throw an error of 'Too little mines!'.
Moreover, if \( M_G \gt max(S_{M_G}) + U_{NA} \), the program will throw an error of 'Too Many Mines!', since the maximum number of mines in a solution set + non-adjacent tiles is the limit that would fill the board with mines.

Convolution to Calculate Mine Count and Frequencies of the Whole Board

Let's consider a board with 2 subsystems. Subsystems, in the context of this calculator, are board systems where adjacent tiles are not shared from other systems, and can be independently calculated for its solutions counting the frequencies and number of mines.
For example: Let's calculate the mines and frequencies map of this whole board with a 1-1-1 and a 2-3-2 for each adjacent tile marked with a number, where the adjacent tiles are not shared between the 1-1-1 and 2-3-2.
\[ \begin{array}{l} MF_0(m) = MF_4(m) = MF_5(m) = MF_6(m) = MF_7(m) = MF_{11}(m)\\ = \begin{cases} 2 & \text{if } m = 2 \\ 0 & \text{otherwise} \end{cases}\\ MF_1(m) = MF_3(m) = MF_8(m) = MF_{10}(m)\\ = \begin{cases} 3 & \text{if } m = 2 \\ 0 & \text{otherwise} \end{cases}\\ MF_2(m) = MF_9(m)\\ = \begin{cases} 1 & \text{if } m = 1 \\ 0 & \text{otherwise} \end{cases}\\ MF_{12}(m) = MF_{16}(m) = MF_{17}(m) = MF_{18}(m) = MF_{19}(m) = MF_{23}(m)\\ = \begin{cases} 2 & \text{if } m = 4 \\ 0 & \text{otherwise} \end{cases}\\ MF_{13}(m) = MF_{15}(m) = MF_{20}(m) = MF_{22}(m)\\ = \begin{cases} 4 & \text{if } m = 3 \\ 9 & \text{if } m = 4 \\ 0 & \text{otherwise} \end{cases}\\ MF_{14}(m) = MF_{21}(m)\\ = \begin{cases} 4 & \text{if } m = 3 \\ 0 & \text{otherwise} \end{cases}\\ \end{array} \] Let's also consider the mine and frequency map functions for each subsystem to count the total number of valid solutions. \(MF_{G_1}\) describes the 1-1-1 subsystem and \(MF_{G_2}\) describes the 2-3-2 subsystem. \[ \begin{array}{l} MF_{G_1}(m) = \begin{cases} 2 & \text{if } m = 1 \\ 12 & \text{if } m = 2 \\ 0 & \text{otherwise} \end{cases}\\ MF_{G_2}(m) = \begin{cases} 8 & \text{if } m = 3 \\ 12 & \text{if } m = 4 \\ 0 & \text{otherwise} \end{cases}\\ \end{array} \] You can verify these numbers by clicking the board above, and pasting it to calculate its probability. Clicking on adjacent tiles will give the number of solutions s and the number of mines m per tile and the system.

Let's define the whole system as \( G_G \) that descibes the set of the solutions for 1-1-1 and 2-3-2 together.

In order to consider the number of solutions of the whole board and tile rather than the individual subsystems, we would have to count each solution from \( G_1 \) and \( G_2 \) by multiplying the valid number of solutions from \( G_1 \) and \( G_2 \). It seems there are (2+12) = 14 valid solutions for \( G_1 \) and (8+12) = 20 valid solutions for \( G_2 \). This means there are a total of 14*20 = 280 solutions that should be considered. For calculating the number of mines, it seems that there can be a minimum of (1+3) = 4 mines and a maximum of (2+4) = 6 mines. There can also be (2+3) = 5 mines as part of the solution too.

With the information of the separate systems, it doesn't tell the number of solutions per mine number for a tile and the whole board. In order to get the total number of solutions and number of mines of the whole board rather, discrete convolution would be used. The convolution formula to get \( MF_{G_G}(m) \), where \( BS = \{1, 2, 3, \dots\} \) describes the subsystems is the following. \[ MF_{G_t}(m) = \sum_{ S \in BS \setminus \{t\} }{ (MF_{G_t} \ast MF_{G_S})(m) } \] We convolve with all other different systems other than itself. To do convolution, we try to add every combination of \( m_t \) from the first map function with \( m'_t \) from another map function. Also, \( n_t \) is multiplied from the first map function with \( n'_t \) from another map function. The function below descibes a dictionary of the convolution of a \( (m_t,m'_t) \) pair and the \( (m,n) \) sum/multiplication pair. \[ CD(MF_1,MF_2) = \left\{ \begin{array}{lll} (m_0,m'_0) : & \{ m: m_0 + m'_0, & n: MF_1(m_0) \cdot MF_2(m'_0) \}\\ (m_0,m'_1) : & \{ m: m_0 + m'_1, & n: MF_1(m_0) \cdot MF_2(m'_1) \}\\ (m_0,m'_2) : & \{ m: m_0 + m'_2, & n: MF_1(m_0) \cdot MF_2(m'_2) \}\\ & \vdots & \vdots \\ (m_1,m'_0) : & \{ m: m_1 + m'_0, & n: MF_1(m_1) \cdot MF_2(m'_0) \}\\ (m_1,m'_0) : & \{ m: m_1 + m'_1, & n: MF_1(m_1) \cdot MF_2(m'_1) \}\\ & \vdots & \vdots \\ (m_a,m'_b) : & \{ m: m_a + m'_b, & n: MF_1(m_a0) \cdot MF_2(m'_b) \}\\ \end{array} \right\} \] We need to sum all \( m_t + m'_t \) pairs that are equal together. The whole convolution formula for some map functions \( MF_1 \) and \( MF_2 \) can finally be defined as the following using Iverson Bracket notation. \[ (MF_1 \ast MF_2)(m) = \sum_{(m_i,m'_j) \text{ s.t. } m_i \in S_{M_1}, m'_j \in S_{M_2} }{[m_i + m'_j = m] \cdot MF_1(m_i) \cdot MF_2(m'_j)} \] The Iverson Bracket notation \( [m_i + m'_j = m] \) means that for every \( m_i + m'_j \) that sums to \( m \), it is 1. Otherwise it is 0 whether \( m_i + m'_j \neq m \). Sum every same \( m \) with \( n_i * n'_j \) or \( MF_1(m_i) \cdot MF_2(m'_j) \)

Using this, the following formulas would be used to get the total number of solutions per mine number of the whole board. \[ \begin{array}{ll} MF_{G_G}(m) &= \sum_{S \in BS \setminus \{1\}}{(MF_1 \ast MF_{G_S})(m)} \\ & = \sum_{S \in BS \setminus \{2\}}{(MF_2 \ast MF_{G_S})(m)} \\ & = \sum_{S \in BS \setminus \{3\}}{(MF_3 \ast MF_{G_S})(m)} \\ & \vdots \end{array} \] The first map function \( MF_1 \) can just be used as the other subsystems 2, 3, 4, ... would result in the same calculation.
An example calculation of \( MF_{G_G} \) is: \[ \begin{array}{ll} CD(MF_{G_1},MF_{G_2}) &= \left\{ \begin{array}{l} (1,3) : \{ m: 1 + 3, n: MF_{G_1}(1) \cdot MF_{G_2}(3) \}\\ (1,4) : \{ m: 1 + 4, n: MF_{G_1}(1) \cdot MF_{G_2}(4) \}\\ (2,3) : \{ m: 2 + 3, n: MF_{G_1}(2) \cdot MF_{G_2}(3) \}\\ (2,4) : \{ m: 2 + 4, n: MF_{G_1}(2) \cdot MF_{G_2}(4) \}\\ \end{array} \right\}\\ &= \left\{ \begin{array}{l} (1,3) : \{ m: 4, n: 16 \}\\ (1,4) : \{ m: 5, n: 24 \}\\ (2,3) : \{ m: 5, n: 96 \}\\ (2,4) : \{ m: 6, n: 144 \}\\ \end{array} \right\}\\ \\ MF_{G_G}(m) &= \begin{cases} 16 & \text{if } m = 4 \\ 24 + 96 & \text{if } m = 5 \\ 144 & \text{if } m = 6 \\ 0 & \text{otherwise} \end{cases} = \begin{cases} 16 & \text{if } m = 4 \\ 120 & \text{if } m = 5 \\ 144 & \text{if } m = 6 \\ 0 & \text{otherwise} \end{cases}\\ \end{array} \] It should be noted that 16 + 120 + 144 = 280, the total number of solutions of 1-1-1 and 2-3-2 board systems combined.
The numbers can be verified by checking the Results tab of the Whole System.

To get the total number of solutions per mine number of a tile, it is similar to the calculation above.
We convolve each tile using every other \( MF_{G_u} \) where \( u \) is not in the same subsystem as the tile. \[ MF_t(m) = \sum_{S \in BS \setminus \{u\}}{(MF_t \ast MF_{G_u})(m)} \text{, } t \text{ is NOT an adjacent tile of } G_u \] Here is an example calculation for tile 0. \[ \begin{array}{ll} CD(MF_0,MF_{G_2}) &= \left\{ \begin{array}{l} (2,3) : \{ m: 2 + 3, n: MF_0(2) \cdot MF_{G_2}(3) \}\\ (2,4) : \{ m: 2 + 4, n: MF_0(2) \cdot MF_{G_2}(4) \}\\ \end{array} \right\}\\ &= \left\{ \begin{array}{l} (2,3) : \{ m: 5, n: 16 \}\\ (2,4) : \{ m: 6, n: 24 \}\\ \end{array} \right\}\\ (MF_0 \ast MF_{G_2})(m) &= \begin{cases} 16 & \text{if } m = 5 \\ 24 & \text{if } m = 6 \\ 0 & \text{otherwise} \end{cases} \end{array} \] So the global probability calculated for tile 0, given the global mine count \( M_G = 9 \), number of non-adjacent tiles \( U_{NA} = 5 \), and using convolution of the map functions is the following: \[ \begin{array}{ll} \text{GlobalProbability}_A(0) &= \frac{ \displaystyle \sum_{ m_0 \in S_{(M_0 \ast M_{G_2})} } (MF_0 \ast MF_{G_2})(m_0) \cdot \binom{U_{NA}}{M_G - m_0} }{ \displaystyle \sum_{ m \in S_{(M_{G_1} \ast M_{G_2})} } (MF_{G_1} \ast MF_{G_2})(m) \cdot \binom{U_{NA}}{M_G - m} }\\ &= \frac{ \displaystyle \sum_{ m_0 \in S_{(M_0 \ast M_{G_2})} } (MF_0 \ast MF_{G_2})(m_0) \cdot \binom{5}{9 - m_0} }{ \displaystyle \sum_{ m \in S_{(M_{G_1} \ast M_{G_2})} } (MF_{G_1} \ast MF_{G_2})(m) \cdot \binom{5}{9 - m} }\\ &= \frac{ (MF_0 \ast MF_{G_2})(5) \cdot \binom{5}{4} + (MF_0 \ast MF_{G_2})(6) \cdot \binom{5}{3} }{ (MF_{G_1} \ast MF_{G_2})(4) \cdot \binom{5}{5} + (MF_{G_1} \ast MF_{G_2})(5) \cdot \binom{5}{4} + (MF_{G_1} \ast MF_{G_2})(6) \cdot \binom{5}{3} }\\ &= \frac{ 16 \cdot 5 + 24 \cdot 10 }{ 16 \cdot 1 + 120 \cdot 5 + 144 \cdot 10 }\\ &= \frac{ 320 }{ 2056 }\\ & \approx 15.6\% \end{array} \] This percentage probability can be verified using the same board and global mine count \( M_G = 9 \).
Close

One main reason why I made this probability calculator was to also find and check the validity of Minesweeper patterns.

A pattern, in the context of this calculator, is where all valid solutions for certain adjacent tiles are either guaranteed safe or a mine. You can click each board for each pattern below to copy the data to the clipboard and paste to the main board to see the probability calculations.

Note: These aren't official names for these patterns. This is mostly just a catalog of patterns that I see throughout the game and the safe/mine tile placements are guaranteed, and I don't have to think about too much of the logic of why it does these patterns.
For more information, comprehension, and the logic for some of these patterns, see https://minesweeper.online/help/patterns, https://computronium.org/minesweeper/index.html, and https://www.youtube.com/@minesweeperstrategy7245
  • Number of Empty Spaces = Number of Mines

    This is a common pattern that you will see. Any time there is a number and the number of spaces is equal to its number, those spaces must be mines.

    For example, here is a corner 1. Since all spaces but the bottom right is filled as safe, the bottom right tile must be a mine.

    Because the 2 is near a wall and 3 adjacent tiles around the 2 are safe, the unknown tiles next to the 2 must be mines.

    Here is an example of a 1-2-3-2-1 wall, where the 3 tiles near the red 3 are mines due to this pattern.
  • Flag Number Reduction

    Whenever you see flags/mines near number tiles, subtract the number by the number of adjacent flag tiles. Here is an example including the Number of Empty Spaces = Number of Mines pattern. The 3 becomes a 2, and the 2 unknown tiles above must be mines.

    Reducing numbers also causes other patterns to show up. For example, here a wall of 3-3-2 is a disguised 1-2-1 pattern. The tiles above the 1s must be mines.
  • Adjacent Tiles Near 0

    All the tiles near 0 must be safe. Generally in Minesweeper and its game clones, they automatically click all 0 tiles and the safe adjacent tiles near the 0s. You generally do not have to manually click 0s as safe.

    However, when using the Flag Number Reduction pattern, if all flags were placed on a number tile, the rest of the tiles near the number must be safe.
    For example, the 3s and the 1s shown both become 0, making all adjacent tiles safe.
  • 1-1

    If a 1-1 pattern is near a wall, or has a tile blocking one side of the 1-1, the corner near the 1-1 is safe.

    Here is an example of a chain of successive 1-1 due to being near a wall and the tile is blocked at the same time.

    A 1-1 can also allow more than one tile to be guaranteed as safe.
    To see the general pattern of minimum tiles to be safe, see the 2D 1-1 pattern.
  • 1-2

    A corner near the 2 is guaranteed a mine, and adjacent tiles of the 1 not adjacent of the 2 is guaranteed safe.
    Note that for the minimum amount of tiles for this to work, at least 2 tiles not touching the 1 has to be safe in order to apply this pattern. This essentially creates a 2D 1-1 pattern.
  • 1-2-1

    This pattern is an extension of the 1-2 pattern, where the mines are always on the sides of the 1s and are touching the corner of the 2.
    To see the general minimum number of tiles that can be safe, see the 2D 1-2-1, 1-3-2, and 2-4-2 pattern.
  • 1-2-2-1

    This pattern is an extension of the 1-2 pattern, where the mines are always on the sides of the 2s and are touching the corner of the 1s.

    Here is an example of a disguised 1-2-2-1 with the Flag Number Reduction pattern. The 1-2-3-3 column with the flags become a 1-2-2-1. Note: The mines could be in either side, but all the sides not near the 2s on the left/right are safe.
  • 1-3-1 Corner

    This pattern has a mine on the outer corner of the 3, and safe tiles on the corner of the 1s not touching the 3.

    The 1-3-1 corner can also have just have, in minimum, just the 3 tiles itself to apply the pattern. This can result in more safe tiles. The reasoning is that the 2 mines between the 3 and 1s must be there. The tile bottom right of the 3 being safe is due to Proof By Contradiction.
  • 2-2-2 Corner

    This pattern does the inverse of the 1-3-1 Corner pattern, where safe tiles are mines, and the mine tile is safe. Note that the 5 safe tiles are required for this pattern to be applied properly.
  • 2D 1-1, 2-2, 3-3

    For this pattern, generally if the number is the same as the left (1, 2, or 3), then the 3 tiles on the right must be safe. The safe x tiles can also be the edge of the board.

    Note that the bottom X on the leftmost tile is not required for the right 3 tiles to be safe.

    This can be helpful when you have 2 length number tiles, both as either 1 or 2.
  • 2D 1-1, 2-2, 3-3 Special Cases

    More special case patterns can be found for these 2D 1-1, 2-2, and 3-3.
    For the 2D 1-1 and 2-2, when clicking the 3 safe tiles, if the middle is also a 1 or 2 respectively, then the next 3 tiles on the right are also safe too. Please note the additional safe X tiles above the top and bottom of the leftmost 1 of 2 in order to do this.

    Here is a special case 2D 1-1, where the bottommost 1 tile (Of the 3 safe tiles) matches the 1 tile on the left. This makes the 4 adjacent tiles on the bottom and right safe.
    Note: The 2D 1-1 can also be 2D 2-2 and 3-3 as well.

    Here is another special case of a 2D 3-3, where the bottommost 2 tile (Of the 3 safe tiles) matches the 2 tile on the left. This makes the 4 adjacent tiles on the bottom and right safe. Additionally, the tiles between the 2s are mines.
    Note: The 2D 3-3 can also be 2D 1-1 and 2-2 as well.
  • 1-3 and 1-4

    These are similar to the 1-2 Pattern, where the tiles left of the 1 must be safe, and the other tiles on the right must be mines. 1-3 must have 1 tile not touching 1 blocked (For example, the X safe tile on the bottom right), and 1-4 just have all 3 mines not touching 1.

    Example of 1-3:

    Example of 1-4:


    Just like the 2D 1-1 pattern, the minimum number of tiles is basically only having 1 and 0 tiles blocked for 1-3 and 1-4 respectively to be applied.
  • 2D 1-4, 2-5, 3-6, and 4-7 and other variants

    You do not have to remember these patterns and numbers, but these patterns show that the tiles are safe on the top 3 adjacent tiles, but there are mines on the bottom 3 adjacent tiles. There is an exception of the 4-7 with additional guaranteed mines.
    Note that just like the 1-2 and 1-3, there are also configurations of (1-2, 2-3, 3-4, and 4,5) for 1-2 and (1-3, 2-4, 3-5, and 4-6) for 1-3.
    It's basically the same patterns as above, with 2 tiles not near the 1 being safe for 1-2 + variants and 1 tile not near the 1 being safe for 1-3 + variants.
  • 2D 1-2-1, 1-3-2, and 2-4-2

    These patterns show the guaranteed safe 8 tiles that are on the left, the right, and the middle. The exceptions are that the 1-3-2 have mines on top and bottom of the 2, and the 2-4-2 have mines on the corner of the 4s.
    A 2-4-2 is a 1-2-1 pattern with mines on all sides except on top and bottom of 4, and left and right of the 2s. A 1-3-2 and 1-2-1 can have one mine that can be on either side of the 1s.
  • 2D 1-2-2-1, 1-3-3-2, and 2-4-4-2

    These are similar to the 2D 1-2-1, 1-3-2, and 2-4-2 patterns, although they are not so common except 1-2-2-1. For the 1-2-2-1, the mines may be on just one side of the 2s, while the 1s are safe.
    2-4-4-2, although not common, behaves similarly to the 2-4-2 pattern, but the mines are near the 4s.
    And finally, 2-3-3-1 behaves similarly to the 2-3-1 pattern, but the 3 next to the 2 is guaranteed to have both mines on its side while the 3 next to the 1 have just 1 mine next to its side.
  • 1-1-1 and 1-1-1-1

    Using the Flag Number Reduction pattern, these patterns are usually disguised, but behave similarly to the 1-2-1 and 1-2-2-1 pattern. However, the mine and safe tiles for 1-2-1 and 1-2-2-1 are inversed for 1-1-1 and 1-1-1-1.
    Here is an example of a disguised 1-1-1

    Here is an example of a disguised 1-1-1-1

    When in doubt if the pattern is applied, you can use Proof by Contradiction to see if the tiles are safe or mines.
  • Shared Mines in Regions

    For a region of tiles, if you know that mines can be shared for 2 different number tiles, you can use this information to do the Flag Number Reduction pattern to use with other patterns.

    For a simple example, the rightmost 2 tile must share 2 mines in the ? regions with the leftmost 2 tile. Therefore, the leftmost 2 becomes a 0, thus the other adjacent tiles for the leftmost tile must be free due to the Adjacent Tiles Near 0 pattern.

    Here is another example that uses another pattern. For the 2 bottom tile numbers, 1 mine must be in one of the 2 tiles while the other is safe.
    Moreover, the 2 number tile on top of the region shares the mine. This makes the 2 tile be a 1 tile.
    Due to these circumstances, this creates a 2D 1-1 pattern, allowing the top tiles on the topmost 1 tile to be safe.


    Here is another complex example that can have more than one region shared. The main takeaway is that all mine configurations must reduce each number properly for ALL valid solutions.
    For the left 4 of all region 1 tiles, there is 1 mine. For the right 4 of all region 2 tiles, there are 2 mines. For the 1 between region 3, there is 1 mine.

    Let's assume there might be a mine in the (1) tile under the left 4. There must be a mine in the (2,3) tile, or the 1 will be underflagged. This makes the tile numbers 2-3 become a 1-2. The right 3 is not considered because a mine in the (2) region might make this either a 2 or 3.

    Let's also assume there might be a mine in the tile under the (1,3) tile. This makes the (1) region have no mine, and (2,3) have no mine too.
    This means that 2 mines must be in the region (2) tiles, making this a valid solution.
    Due to this configuration, the tile numbers 2-3 also become a 1-2 as well.

    When considering all of these possible mine configurations, the 2-3 becomes a 1-2 for all solutions, and thus creates a 1-2 pattern, and would be applied as shown below.
  • Proof By Contradiction

    Sometimes you might have to assume a tile is a mine or safe, especially if there are no more patterns to see in a No Guess minesweeper mode (A mode where a board is always solvable, and you do not have to guess).
    If the assumption contradicts for all solutions possible, then the tile must be the opposite of the assumption instead.
    Here is an example of proof by contradiction.

    Let's assume that tile (2) is a mine tile. This makes tile (1) and (3) safe tiles. However, a contradiction happens because the 5 tile has only 4 flags and is underflagged. Due to this, (2) must be a safe tile instead as shown below. This also causes (1) and (3) to be mine tiles instead.
Close

Results are shown after clicking 'Calculate Probability'
Use Escape to deselect a tile. Hold down Shift and click to multi-select more than one tile. Use the arrow keys or WASD to move the select region by 1 tile. You can hover over each tile below for its description. Holding Ctrl and then using C/X/V/A/Z can be used to copy, cut, paste, select all, and undo respectively.