skillfed

natsort

Simple yet flexible natural sorting in Python.

natsort Permissive license MIT Active 1,015 v8.4.0 released

Install

natsort on PyPI

pip

pip install natsort

uv

uv add natsort

poetry

poetry add natsort

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.7)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 1,150 days since the last release
Last repo commit
First released
Popularity one of the top 1,000 most-downloaded packages on PyPI (30-day window, as of 2026-08-13)
Known vulnerabilities none known (OSV.dev, checked 2026-08-13)

Evidence: natsort-8.4.0-py3-none-any.whl

Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: Financial and Insurance IndustryIntended Audience :: Information TechnologyIntended Audience :: Science/ResearchIntended Audience :: System AdministratorsLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Scientific/Engineering :: Information AnalysisTopic :: Text ProcessingTopic :: Utilities

About natsort

from the package's own PyPI description — quoted content, verbatim

natsort

.. image:: https://img.shields.io/pypi/v/natsort.svg :target: https://pypi.org/project/natsort/

.. image:: https://img.shields.io/pypi/pyversions/natsort.svg :target: https://pypi.org/project/natsort/

.. image:: https://img.shields.io/pypi/l/natsort.svg :target: https://github.com/SethMMorton/natsort/blob/main/LICENSE

.. image:: https://github.com/SethMMorton/natsort/workflows/Tests/badge.svg :target: https://github.com/SethMMorton/natsort/actions

.. image:: https://codecov.io/gh/SethMMorton/natsort/branch/main/graph/badge.svg :target: https://codecov.io/gh/SethMMorton/natsort

.. image:: https://img.shields.io/pypi/dw/natsort.svg :target: https://pypi.org/project/natsort/

Simple yet flexible natural sorting in Python.

- Source Code: https://github.com/SethMMorton/natsort
- Downloads: https://pypi.org/project/natsort/
- Documentation: https://natsort.readthedocs.io/

  - `Examples and Recipes`_
  - `How Does Natsort Work?`_
  - `API`_

- `Quick Description`_
- `Quick Examples`_
- `FAQ`_
- `Requirements`_
- `Optional Dependencies`_
- `Installation`_
- `How to Run Tests`_
- `How...

Read as markdown · JSON record · Source repository · Homepage

AI interpretation — verify before relying

AI-generated interpretation of the package facts above; every digit, version, license, or vulnerability id it cites is grounded in the facts already shown on this page

natsort provides natural sorting for strings containing numbers, ordering them by numeric value rather than lexicographic order—so '10' sorts after '9' instead of after '1'.

Installs with zero runtime dependencies and is distributed as a pure-Python wheel, making it friction-free. The project shows active maintenance with recent commits and is classified as Production/Stable.

Licensed under MIT (permissive), allowing unrestricted use, modification, and distribution in both open-source and proprietary projects with minimal obligations.

Usage

pip install natsort
from natsort import natsorted
a = ['2 ft 7 in', '1 ft 5 in', '10 ft 2 in']
result = natsorted(a)
print(result)  # ['1 ft 5 in', '2 ft 7 in', '10 ft 2 in']

Verdict: natsort is a mature, zero-dependency utility for natural sorting that solves a common problem elegantly. With active maintenance, no known vulnerabilities, permissive licensing, and top-1000 popularity, it is a safe and practical choice for any project needing human-friendly string sorting.

Needs verification

  • Whether optional PyICU dependency improves locale-aware sorting enough to warrant installation for non-Windows users
  • Performance characteristics on very large datasets compared to built-in sorted()
natural sort numbers in stringsalphanumeric sortinghuman-friendly list sortingversion number sortingnumeric-aware string sortnatural language sortingfile path sorting

Similar packages