SWI-Prolog offers a comprehensive and portable free-software Prolog programming environment for more than 25 years now. It is widely used in research and education as well as for commercial applications. For the first time in print, this is the official reference manual for the latest version of SWI-Prolog.SWI-Prolog aims to be a robust and scalable implementation closely compatible to the ISO Prolog standard. It ships with a wide range of interface libraries, providing interfaces to other languages such as C and Java, databases, graphics and networking. It provides extensive support for managing HTML/SGML/XML and RDF documents. The system is particularly suited for server applications due to robust support for multi threading and HTTP server libraries.The SWI-Prolog development environment includes extensive editor support, graphical source-level debugger, autoloading and make facility. The SWI-Prolog editor and the PDT plugin for Eclipse provide alternative environments.This comprehensive manual gives an overview of the system and how to set-up programming projects with it, it describes the built-in predicates, module system, coroutining, threads, the Constraint Handling Rules library, the foreign language interface and how to generate runtime applications.