The most popular spellchecking library.
Clone or download
Latest commit aec4cac Sep 14, 2018
Failed to load latest commit information.
docs updated reference to certain tests Mar 6, 2018
m4 remove unused lefovers Jul 6, 2018
msvc Prepare 1.6.2 release Sep 3, 2017
po Remove included gettext Oct 22, 2017
src Improve detecting c++11. Better use of HUNSPELL_THREAD_LOCAL. Sep 14, 2018
tests remove unused lefovers Jul 6, 2018
.gitignore remove unused lefovers Jul 6, 2018
.travis.yml refactored unit tests from cppunit to catch Oct 30, 2017
ABOUT-NLS Remove included gettext Oct 22, 2017
AUTHORS Mention copyright holder of in AUTHORS Dec 13, 2017
COPYING Remove hunspell 2. Will be moved to separate repo. Nov 22, 2017
COPYING.LESSER Remove hunspell 2. Will be moved to separate repo. Nov 22, 2017
COPYING.MPL Revert "License everything under LGPLv3+. No more three licenses mumb… Nov 17, 2017
ChangeLog minor documentation improvements Nov 20, 2017
ChangeLog.O Initial Import Feb 23, 2010 remove unused lefovers Jul 6, 2018
NEWS Prepare 1.6.2 release Sep 3, 2017
README Some trickery to make the README appear on Github mobile Dec 1, 2016 Fix typos Dec 16, 2017
THANKS Remove some old text files Aug 15, 2017
appveyor.yml refactored unit tests from cppunit to catch Oct 30, 2017
config.rpath Remove included gettext Oct 22, 2017 Improve detecting c++11. Better use of HUNSPELL_THREAD_LOCAL. Sep 14, 2018 fix typo in pkgconfig.pc Feb 27, 2010
license.hunspell Revert "License everything under LGPLv3+. No more three licenses mumb… Nov 17, 2017
license.myspell Initial Import Feb 23, 2010

About Hunspell

Hunspell is a spell checker and morphological analyzer library and program designed for languages with rich morphology and complex word compounding or character encoding. Hunspell interfaces: Ispell-like terminal interface using Curses library, Ispell pipe interface, C++ class and C functions.

Hunspell's code base comes from the MySpell ( See README.MYSPELL, AUTHORS.MYSPELL and license.myspell files. Hunspell is designed to eventually replace Myspell in

Main features of Hunspell spell checker and morphological analyzer:

  • Unicode support (affix rules work only with the first 65535 Unicode characters)
  • Morphological analysis (in custom item and arrangement style) and stemming
  • Max. 65535 affix classes and twofold affix stripping (for agglutinative languages, like Azeri, Basque, Estonian, Finnish, Hungarian, Turkish, etc.)
  • Support complex compounds (for example, Hungarian and German)
  • Support language specific features (for example, special casing of Azeri and Turkish dotted i, or German sharp s)
  • Handle conditional affixes, circumfixes, fogemorphemes, forbidden words, pseudoroots and homonyms.
  • Free software. Versions 1.x are licenced under LGPL, GPL, MPL tri-license. Version 2 is licenced only under GNU LGPL.


Build only dependencies:

g++ make autoconf automake autopoint libtool

Runtime dependencies:

Mandatory Optional
libhunspell 1
cmd line tool 1 libiconv gettext ncurses readline

Recommended tools for developers:

vim qtcreator clang-format cppcheck gdb libtool-bin doxygen plantuml

Compiling on GNU/Linux and Unixes

We first need to download the dependencies. On Linux, gettext and libiconv are part of the standard library. On other Unixes we need to manually install them.

For Ubuntu:

sudo apt install autoconf automake autopoint libtool libboost-locale-dev \

Then run the following commands:

autoreconf -vfi
sudo make install
sudo ldconfig

For dictionary development, use the --with-warnings option of configure.

For interactive user interface of Hunspell executable, use the --with-ui option.

Optional developer packages:

  • ncurses (need for --with-ui), eg. libncursesw5 for UTF-8
  • readline (for fancy input line editing, configure parameter: --with-readline)

In Ubuntu, the packages are:

libncurses5-dev libreadline-dev

Compiling on OSX and macOS

On macOS for compiler always use clang and not g++ because Homebrew dependencies are build with that.

brew install autoconf automake libtool gettext boost
brew link gettext --force

Then run the standard trio: autoreconf, configure, make. See above.

Compiling on Windows

1. Compiling with Mingw64 and MSYS2

Download Msys2, update everything and install the following packages:

pacman -S base-devel mingw-w64-x86_64-toolchain mingw-w64-x86_64-libtool \

Open Mingw-w64 Win64 prompt and compile the same way as on Linux, see above.

2. Compiling in Cygwin environment

Download and install Cygwin environment for Windows with the following extra packages:

  • make
  • automake
  • autoconf
  • libtool
  • gcc-g++ development package
  • boost
  • ncurses, readline (for user interface)
  • iconv (character conversion)

Then compile the same way as on Linux. Cygwin builds depend on Cygwin1.dll.


It is recommended to install a debug build of the standard library:


For debugging we need to create a debug build and then we need to start gdb.

./configure CXXFLAGS='-g -O0 -Wall -Wextra'
./libtool --mode=execute gdb src/tools/hunspell

You can also pass the CXXFLAGS directly to make without calling ./configure, but we don't recommend this way during long development sessions.

If you like to develop and debug with an IDE, see documentation at


Testing Hunspell (see tests in tests/ subdirectory):

make check

or with Valgrind debugger:

make check
VALGRIND=[Valgrind_tool] make check

For example:

make check
VALGRIND=memcheck make check


features and dictionary format:

man 5 hunspell
man hunspell
hunspell -h

Documentation for developers can be generated from the source files by running:


The result can be viewed by opening doxygen/html/index.html in a web browser. Doxygen will use Graphviz for generating all sorts of graphs and PlantUML for generating UML diagrams. Make sure that the packages plantuml and graphviz are installed before running Doxygen. The latter is usually installed automatically when installing Doxygen.


The src/tools directory contains ten executables after compiling.

  • The main executable:
    • hunspell: main program for spell checking and others (see manual)
  • Example tools:
    • analyze: example of spell checking, stemming and morphological analysis
    • chmorph: example of automatic morphological generation and conversion
    • example: example of spell checking and suggestion
  • Tools for dictionary development:
    • affixcompress: dictionary generation from large (millions of words) vocabularies
    • makealias: alias compression (Hunspell only, not back compatible with MySpell)
    • wordforms: word generation (Hunspell version of unmunch)
    • hunzip: decompressor of hzip format
    • hzip: compressor of hzip format
    • munch (DEPRECATED, use affixcompress): dictionary generation from vocabularies (it needs an affix file, too).
    • unmunch (DEPRECATED, use wordforms): list all recognized words of a MySpell dictionary

After compiling and installing (see INSTALL) you can run the Hunspell spell checker (compiled with user interface) with a Hunspell or Myspell dictionary:

hunspell -d en_US text.txt

or without interface:

hunspell -d en_UK -l <text.txt

Dictionaries consist of an affix and dictionary file, see tests/ or

Using Hunspell library with GCC

Including in your program:

#include <hunspell.hxx>

Linking with Hunspell static library:

g++ -lhunspell-1.6 example.cxx
# or better, use pkg-config
g++ $(pkg-config --cflags --libs hunspell) example.cxx


Myspell & Hunspell dictionaries:

Aspell dictionaries (need some conversion):


Conversion steps: see relevant feature request at .

László Németh, nemeth at numbertext org