Switch branches/tags
QKalign2b SF6_status SF7_status SpaceRankandWeight TrappedRook4 accurate_pv_2 advppush1 advppush2 advppush3 all1 all2 appveyor asymm1 asymm2 asymm3 atksq1 atkthru2 atomics attackRook1 back1 backward backward2 backward3 bish1 bishopavoid1 bishoppawn1 bishoppawn2 blocked1 blocked2 blocked3 blocked4 books bw_contempt1 bw_contempt2b bw_contempt2c bw_contempt2 bw_contempt3b bw_contempt3 bwcontempt1tune bwcontempt1 bwcontempt2 c++11 castle1b castle1 castle2 castle4 castle5 complex2tune complex2 complex3 con0b con0 con1 con5b con5 con20b con20 conlosing1 conmin connect1 connect2 connect4 connect5 conrev1 coverity_scan crash1 d6_1 dblpawn1 dblrook1 delaycon2 delaycon3 delaycon4 delta1 delta2 delta3b delta3c delta3 delta5 domknight1 doubled_level doubled2 doubled3 draw2_alpha_maxply24 draw2b draw2_beta_maxply24 draw2_beta_maxply25 draw2c draw2_maxply20_move draw2_maxply20_move2 draw2_maxply20 draw2_maxply24_move draw2_maxply24 draw2_maxply26 draw2 draw3b draw3 draw4 dyn_cap1tune dyn_cap2b dyn_cap2tune dyn_cap2 dyn_cap3b dyn_cap3c_kingdanger dyn_cap3c_mobdanger dyn_cap3c dyn_cap3tune dyn_cap3 dynamic1tune dynamic1 dynamic2tune dynamic2 dynamic3tune dynamic3 dynamic4b dynamic4tune dynamic5d dynamic5dtune e6_2_tune e6_2 e6_3 emplace1 farside1 fian1 fixedprep fmc1tune fmc1 fmc2 futmgn1tune futmgn1 futmgn2 gcc_bug givescheck1 improving1 initMat initMat2 initMat3 initMat4 initMat5b initMat5 initiative1 initiative2 initiative3 initiative4tune initiative4 initiative5 initiative6 initiativetune1 initpawns1 initpawns2 isolated1 kf8a kf8b kf8c kf8_cs kf8d kf8dtune kf8e kf8g kf8h kf8_mob0 kf8_rm kf8_tomi1 kingdanger1 ksafety2 lazy_smp levers1 levers2 levers3 lowdepth1 lsb1 lsb2tune lsb2 lsb3 master_time_fails master mat1 mat2 mat3 maxply20 maxply24 maxply26 measure_mvoh mob2 mob3 mob5 mob7 mobknight1 mobknight2 movedraws1 movestogo movestogo3b movestogo3c movestogo3cfix movestogo3cfix2 movestogo3cfix3 movestogo3 noadj opb1 opb2 opb3b opb3c opb3 opb4 opb5b opb5 opb6 opb7 opb8 open1 open2tune open2 open3 open4 open5 open6tune open6 open7tune open7 outflank1 outpost_tune outpost3 outpost4 outpost5 outpost6b outpost6 outpost9 overload1 passed1 pawnEndgames2 pawnblock1 pawndist1 pawndist2 pawndist3 pawndist4 pawnpair1b pawnpair1 pawnpair2 pawnstorm1 pawnstorm2 pawnwidth perp1 perp2 perp5 perp6b perp6c perp6 phased_contempt_infinite phased_contempt3_infinite phased_contempt3_no_draw_adjudication posking1 pressure pressure2 pressure3 psqt_tune1 psqt1 psqtrk1 push3 qless1 qless3 qless4 qless5b qless5c qless5d qless5 qless7 qless8 queenBetween queenatk1 rep2 repeat1 reporteval reporteval2 restrict1 restrict2 rookmob1 rookmob3 rookmob4 rule50a safeq1 salc1 salc2 salc3 sf_dd_base sf_2.3.1_base sf_3_base sf_4_base sf_5_base sf9_2mv shelter1 shelter2 shelter3 shelter4 simplify1 sing1 sing3 space2b space2 space3 space4 space5b space5c space5d space5 space6b space6 space8 space9b space10 space11 space12 stochastic1 storm1 storm2 storm3 strongbishop3 syzygy tb_dbg thorn1 threadContempt threats1 threats3 threats4pr threats4 threats5b threats5 threats6b threats6 time_smooth time_smooth3 time_smooth4 time1b time1c time1 time2 time3 time4b time4 time5tune time5 timeadd1 timecon2tune timecon2 timeopen1 tr1 tr3tune tr3 tr4 trappedrook1 trappedrook2tune trappedrook2 trappedrook3 trappedrook4 trappedrook5 trappedrook6 trappedrook7 traprk6tune tropism1 tune_delta1 tune undefPawns_noadj undefPawns undefended1 unstablepv1 unstablepv2 variety1 variety2 velbo1 weak1 weak2 weak3b weak3 weak4 weakkr1tune weakkr1 weakkr3 weight3b weight3dtune weight3e weight3etune weight3f weight3g winning1 winning2 winning4 winning5 winning6tune winning6 winning7b winning7btune winning7 winning8b winning8i winning8 winning9b winning9tune winning9
Nothing to show
Clone or download
Pull request Compare This branch is even with official-stockfish:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
Top CPU Contributors.txt



Build Status Build Status

Stockfish is a free UCI chess engine derived from Glaurung 2.1. It is not a complete chess program and requires some UCI-compatible GUI (e.g. XBoard with PolyGlot, eboard, Arena, Sigma Chess, Shredder, Chess Partner or Fritz) in order to be used comfortably. Read the documentation for your GUI of choice for information about how to use Stockfish with it.

This version of Stockfish supports up to 512 cores. The engine defaults to one search thread, so it is therefore recommended to inspect the value of the Threads UCI parameter, and to make sure it equals the number of CPU cores on your computer.

This version of Stockfish has support for Syzygybases.


This distribution of Stockfish consists of the following files:

  • Readme.md, the file you are currently reading.

  • Copying.txt, a text file containing the GNU General Public License.

  • src, a subdirectory containing the full source code, including a Makefile that can be used to compile Stockfish on Unix-like systems.



Syzygybases are configured using the UCI options "SyzygyPath", "SyzygyProbeDepth", "Syzygy50MoveRule" and "SyzygyProbeLimit".

The option "SyzygyPath" should be set to the directory or directories that contain the .rtbw and .rtbz files. Multiple directories should be separated by ";" on Windows and by ":" on Unix-based operating systems. Do not use spaces around the ";" or ":".

Example: C:\tablebases\wdl345;C:\tablebases\wdl6;D:\tablebases\dtz345;D:\tablebases\dtz6

It is recommended to store .rtbw files on an SSD. There is no loss in storing the .rtbz files on a regular HD.

Increasing the "SyzygyProbeDepth" option lets the engine probe less aggressively. Set this option to a higher value if you experience too much slowdown (in terms of nps) due to TB probing.

Set the "Syzygy50MoveRule" option to false if you want tablebase positions that are drawn by the 50-move rule to count as win or loss. This may be useful for correspondence games (because of tablebase adjudication).

The "SyzygyProbeLimit" option should normally be left at its default value.

What to expect If the engine is searching a position that is not in the tablebases (e.g. a position with 8 pieces), it will access the tablebases during the search. If the engine reports a very large score (typically 123.xx), this means that it has found a winning line into a tablebase position.

If the engine is given a position to search that is in the tablebases, it will use the tablebases at the beginning of the search to preselect all good moves, i.e. all moves that preserve the win or preserve the draw while taking into account the 50-move rule. It will then perform a search only on those moves. The engine will not move immediately, unless there is only a single good move. The engine likely will not report a mate score even if the position is known to be won.

It is therefore clear that behaviour is not identical to what one might be used to with Nalimov tablebases. There are technical reasons for this difference, the main technical reason being that Nalimov tablebases use the DTM metric (distance-to-mate), while Syzygybases use a variation of the DTZ metric (distance-to-zero, zero meaning any move that resets the 50-move counter). This special metric is one of the reasons that Syzygybases are more compact than Nalimov tablebases, while still storing all information needed for optimal play and in addition being able to take into account the 50-move rule.

Compiling it yourself

On Unix-like systems, it should be possible to compile Stockfish directly from the source code with the included Makefile.

Stockfish has support for 32 or 64-bit CPUs, the hardware POPCNT instruction, big-endian machines such as Power PC, and other platforms.

In general it is recommended to run make help to see a list of make targets with corresponding descriptions. When not using the Makefile to compile (for instance with Microsoft MSVC) you need to manually set/unset some switches in the compiler command line; see file types.h for a quick reference.

Resource For Understanding the Code Base

  • Chess Programming Wiki has good overall chess engines explanations (techniques used here are well explained like hash maps etc), it was also recommended by the support team at stockfish.

  • Here you can find a set of features and techniques used by Stockfish and each of them is explained at the wiki, however, it's a generic way rather than focusing on Stockfish's own implementation, but it will still help you.

Terms of use

Stockfish is free, and distributed under the GNU General Public License (GPL). Essentially, this means that you are free to do almost exactly what you want with the program, including distributing it among your friends, making it available for download from your web site, selling it (either by itself or as part of some bigger software package), or using it as the starting point for a software project of your own.

The only real limitation is that whenever you distribute Stockfish in some way, you must always include the full source code, or a pointer to where the source code can be found. If you make any changes to the source code, these changes must also be made available under the GPL.

For full details, read the copy of the GPL found in the file named Copying.txt.