diff --git a/README.md b/README.md
index 328897a0d9049fe9a14fa0e9a543fb515757e9ba..784815807cbb27d4c98dc29cccc4a49536119216 100644
--- a/README.md
+++ b/README.md
@@ -83,6 +83,7 @@ Available flags are:
 | exif | 0 | Builtin EXIF tag display support |
 | help | 0 | include help text (refers to the manpage otherwise) |
 | stat64 | 0 | Support CIFS shares from 64bit hosts on 32bit machines |
+| verscmp | 1 | Support naturing sorting (`--version-sort`). Requires a GNU-compatible libc exposing `strverscmp` |
 | xinerama | 1 | Support Xinerama/XRandR multiscreen setups |
 
 So, by default **libcurl** and **Xinerama** are enabled, the rest is disabled.
diff --git a/config.mk b/config.mk
index 8769b1d6230875b437b3073919f86d5f92d82742..226c61228eaf1b917152bcc77f9b9cf21ba23d7e 100644
--- a/config.mk
+++ b/config.mk
@@ -5,9 +5,10 @@ app ?= 0
 cam ?= 0
 curl ?= 1
 debug ?= 0
+exif ?= 0
 help ?= 0
+verscmp ?= 1
 xinerama ?= 1
-exif ?= 0
 
 # Prefix for all installed files
 PREFIX ?= /usr/local
@@ -63,6 +64,13 @@ ifeq (${stat64},1)
 	CFLAGS += -D_FILE_OFFSET_BITS=64
 endif
 
+ifeq (${verscmp},1)
+	CFLAGS += -DHAVE_VERSCMP
+	MAN_VERSCMP = enabled
+else
+	MAN_VERSCMP = disabled
+endif
+
 ifeq (${xinerama},1)
 	CFLAGS += -DHAVE_LIBXINERAMA
 	LDLIBS += -lXinerama
diff --git a/man/Makefile b/man/Makefile
index 65f2bc27ad9fbe74cd380411aacd1871e4824409..9209de1e6d210a3d3f7fca4b96e08ffdda916848 100644
--- a/man/Makefile
+++ b/man/Makefile
@@ -12,6 +12,7 @@ all: ${TARGETS}
 	-e 's/\$$MAN_CURL\$$/${MAN_CURL}/' \
 	-e 's/\$$MAN_DEBUG\$$/${MAN_DEBUG}/' \
 	-e 's/\$$MAN_EXIF\$$/${MAN_EXIF}/' \
+	-e 's/\$$MAN_VERSCMP\$$/${MAN_VERSCMP}/' \
 	-e 's/\$$MAN_XINERAMA\$$/${MAN_XINERAMA}/' \
 	< ${@:.1=.pre} > $@
 
diff --git a/man/feh.pre b/man/feh.pre
index ab3f8d66f3a2a979dc4af5287b01b12a79a38992..5290f79387e80325139159a422802c40ba1020cc 100644
--- a/man/feh.pre
+++ b/man/feh.pre
@@ -24,7 +24,8 @@ $VERSION$
 .
 .Pp
 .
-Compile-time switches: libcurl support $MAN_CURL$, Xinerama support
+Compile-time switches: libcurl support $MAN_CURL$, natural sorting support
+$MAN_VERSCMP$, Xinerama support
 $MAN_XINERAMA$, builtin EXIF support $MAN_EXIF$$MAN_DEBUG$
 .
 .
@@ -194,7 +195,7 @@ Extra actions which can be set and triggered using the appropriate number key.
 .
 .It Cm --auto-rotate
 .
-.Pq only if compiled with exif=1
+.Pq optional feature, $MAN_EXIF$ in this build
 Automatically rotate images based on EXIF data. Does not alter the image files.
 .
 .It Cm -Z , --auto-zoom
@@ -253,7 +254,7 @@ Draw the defined actions and what they do at the top-left of the image.
 .
 .It Cm --draw-exif
 .
-.Pq only if compiled with exif=1
+.Pq optional feature, $MAN_EXIF$ in this build
 display some EXIF information in the bottom left corner, similar to using
 .Cm --info
 with exiv2 / exifgrep .
@@ -514,8 +515,8 @@ managers.
 .
 .It Cm --no-xinerama
 .
-Disable Xinerama support.  Only makes sense when you have Xinerama support
-compiled in.
+.Pq optional feature, $MAN_XINERAMA$ in this build
+Disable Xinerama support.
 .
 .It Cm -j , --output-dir Ar directory
 .
@@ -696,8 +697,18 @@ output useful information, progress bars, etc.
 .
 output version information and exit.
 .
+.It Cm --version-sort
+.
+.Pq optional feature, $MAN_VERSCMP$ in this build
+Use natural sorting for file and directory names. In this mode, filenames are
+sorted as an ordinary human would expect, e.g.
+.Qq 2.jpg
+comes before
+.Qq 10.jpg .
+.
 .It Cm --xinerama-index Ar screen
 .
+.Pq optional feature, $MAN_XINERAMA$ in this build
 Override
 .Nm Ns No 's
 idea of the active Xinerama screen. May be useful in certain circumstances
@@ -1282,7 +1293,7 @@ Toggle filename display
 .
 .It e Bq toggle_exif
 .
-.Pq only if compiled with exif=1
+.Pq optional feature, $MAN_EXIF$ in this build
 Toggle EXIF tag display
 .
 .It f Bq save_filelist
@@ -1695,10 +1706,14 @@ Show all images in ~/Pictures
 .
 Recursively show all images found in ~/Pictures and subdirectories
 .
-.It feh -rSfilename ~/Pictures
+.It feh -rSfilename --version-sort ~/Pictures
 .
-Same as above, but sort by filename. By default, feh will show files in the
-order it finds them on the hard disk, which is usually somewhat random.
+Same as above, but sort naturally. By default, feh will show files in the
+string order of their names, meaning e.g.
+.Qq foo 10.jpg
+will come before
+.Qq foo 2.jpg .
+In this case, they are instead ordered as a human would expect.
 .
 .It feh -t -Sfilename -E 128 -y 128 -W 1024 ~/Pictures
 .
diff --git a/src/feh.h b/src/feh.h
index 63771b64965b952a99c3b9c95a80fe305e6d710a..3e0cddac1dd7be76332f28e85d3d73bb14222d51 100644
--- a/src/feh.h
+++ b/src/feh.h
@@ -27,6 +27,14 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #ifndef FEH_H
 #define FEH_H
 
+/*
+ * strverscmp(3) is a GNU extension. In most supporting C libraries it
+ * requires _GNU_SOURCE to be defined.
+ */
+#ifdef HAVE_VERSCMP
+#define _GNU_SOURCE
+#endif
+
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
 #include <X11/Xatom.h>
diff --git a/src/filelist.c b/src/filelist.c
index 9a4af27f2d81e8bb92c26cc03911f5e45c3424e1..453f795c3b4604a07f24d038f7ebc618ed557f05 100644
--- a/src/filelist.c
+++ b/src/filelist.c
@@ -397,14 +397,26 @@ void feh_file_dirname(char *dst, feh_file * f, int maxlen)
 	dst[n] = '\0';
 }
 
+#ifdef HAVE_VERSCMP
+inline int strcmp_or_strverscmp(const char *s1, const char *s2)
+{
+	if (!opt.version_sort)
+		return(strcmp(s1, s2));
+	else
+		return(strverscmp(s1, s2));
+}
+#else
+#define strcmp_or_strverscmp strcmp
+#endif
+
 int feh_cmp_filename(void *file1, void *file2)
 {
-	return(strcmp(FEH_FILE(file1)->filename, FEH_FILE(file2)->filename));
+	return(strcmp_or_strverscmp(FEH_FILE(file1)->filename, FEH_FILE(file2)->filename));
 }
 
 int feh_cmp_name(void *file1, void *file2)
 {
-	return(strcmp(FEH_FILE(file1)->name, FEH_FILE(file2)->name));
+	return(strcmp_or_strverscmp(FEH_FILE(file1)->name, FEH_FILE(file2)->name));
 }
 
 int feh_cmp_dirname(void *file1, void *file2)
@@ -413,7 +425,7 @@ int feh_cmp_dirname(void *file1, void *file2)
 	int cmp;
 	feh_file_dirname(dir1, FEH_FILE(file1), PATH_MAX);
 	feh_file_dirname(dir2, FEH_FILE(file2), PATH_MAX);
-	if ((cmp = strcmp(dir1, dir2)) != 0)
+	if ((cmp = strcmp_or_strverscmp(dir1, dir2)) != 0)
 		return(cmp);
 	return(feh_cmp_name(file1, file2));
 }
diff --git a/src/help.raw b/src/help.raw
index 8b244c18971c8b3e128a87dcb8130827974c15d8..86bb617f1335e362d98dfbd5022907242fe34a6c 100644
--- a/src/help.raw
+++ b/src/help.raw
@@ -52,6 +52,7 @@ OPTIONS
                            name, filename, mtime, width, height, pixels, size,
                            or format
  -n, --reverse             Reverse sort order
+     --version-sort        Natural sort of (version) numbers within text
  -A, --action [;]ACTION    Specify action to perform when pressing <return>.
                            Executed by /bin/sh, may contain FORMAT SPECIFIERS
                            reloads image with \";\", switches to next otherwise
diff --git a/src/options.c b/src/options.c
index 0ad7c74991c1fc83650caa0773e31a623721e8d5..3d1148264c8b568a396ac26fc9063aa6a1f0d0d8 100644
--- a/src/options.c
+++ b/src/options.c
@@ -415,6 +415,7 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun)
 		{"insecure"      , 0, 0, 240},
 		{"no-recursive"  , 0, 0, 241},
 		{"cache-size"    , 1, 0, 243},
+		{"version-sort"  , 0, 0, 246},
 		{0, 0, 0, 0}
 	};
 	int optch = 0, cmdx = 0;
@@ -780,6 +781,9 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun)
 			if (opt.cache_size > 2048)
 				opt.cache_size = 2048;
 			break;
+		case 246:
+			opt.version_sort = 1;
+			break;
 		default:
 			break;
 		}
diff --git a/src/options.h b/src/options.h
index 33b2bd35b63e316afa41983d67a82c706c28ea23..c6b4e0ef2dd854df9eae65242ccdb257f4b4db07 100644
--- a/src/options.h
+++ b/src/options.h
@@ -104,6 +104,7 @@ struct __fehoptions {
 	unsigned int thumb_redraw;
 	double reload;
 	int sort;
+	int version_sort;
 	int debug;
 	int geom_flags;
 	int geom_x;