diff --git a/docs/src/markdown/about/changelog.md b/docs/src/markdown/about/changelog.md
index 02a0f15..11876ad 100644
--- a/docs/src/markdown/about/changelog.md
+++ b/docs/src/markdown/about/changelog.md
@@ -9,6 +9,7 @@
   some exceptions. (#72, #73)
 - **FIX**: Don't compare prefixes when evaluating attribute namespaces, compare the actual namespace. (#75)
 - **FIX**: Split whitespace attribute lists by all whitespace characters, not just space.
+- **FIX**: `:nth-*` patterns were converting numbers to base 16 when they should have been converting to base 10.
 
 ## 1.6.2
 
diff --git a/soupsieve/css_parser.py b/soupsieve/css_parser.py
index c41ce7e..ac1a2cd 100644
--- a/soupsieve/css_parser.py
+++ b/soupsieve/css_parser.py
@@ -518,8 +518,8 @@ class CSSParser(object):
                 s2 += nth_parts.group('b')
             else:
                 s2 = '0'
-            s1 = int(s1, 16)
-            s2 = int(s2, 16)
+            s1 = int(s1, 10)
+            s2 = int(s2, 10)
 
         pseudo_sel = util.lower(m.group('pseudo_nth' + postfix))
         if postfix == '_child':

:nth-of-type and :nth-child works only up to the 9th element
Not sure where to file this bug as I'm using soupsieve via BeautifulSoup4, but here goes:

Using BeautifulSoup4 4.7.1, with SoupSieve 1.6.2, under Python 3.6.

```py
import bs4

source = """<html><body>
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div>8</div>
<div>9</div>
<div>10</div>
<div>11</div>
<div>12</div>
<div>12</div>
<div>13</div>
<div>14</div>
<div>15</div>
<div>16</div>
</body></html>"""
soup = bs4.BeautifulSoup(source, 'lxml')  # same result with html5lib

print(soup.select("div:nth-of-type(9)"))  # Expect 9, is 9
print(soup.select("div:nth-child(9)"))  # Expect 9, is 9
print(soup.select("div:nth-of-type(10)"))  # Expect 10, is 15
print(soup.select("div:nth-child(10)"))  # Expect 10, is 15
print(soup.select("div:nth-of-type(11)"))  # Expect 11, is 16
print(soup.select("div:nth-child(11)"))  # Expect 11, is 16
print(soup.select("div:nth-of-type(12)"))  # Expect 12, finds nothing
print(soup.select("div:nth-child(12)"))  # Expect 12, finds nothing
```

It seems to work well with single-digit index, but either returns empty or the wrong element for 10 and upwards.

(Also filed this on BS4 LaunchPad.)
diff --git a/tests/test_level3.py b/tests/test_level3.py
index a533043..b8c4ba9 100644
--- a/tests/test_level3.py
+++ b/tests/test_level3.py
@@ -891,6 +891,57 @@ class TestLevel3(util.TestCase):
         fragment = soup.p.extract()
         self.assertTrue(sv.match("p:nth-child(1)", fragment, flags=sv.DEBUG))
 
+    def test_nth_child_issue_78(self):
+        """Test issue for https://github.com/facelessuser/soupsieve/issues/78."""
+
+        markup = """<html><body>
+        <div id= "1">1</div>
+        <div id= "2">2</div>
+        <div id= "3">3</div>
+        <div id= "4">4</div>
+        <div id= "5">5</div>
+        <div id= "6">6</div>
+        <div id= "7">7</div>
+        <div id= "8">8</div>
+        <div id= "9">9</div>
+        <div id= "10">10</div>
+        <div id= "11">11</div>
+        <div id= "12">12</div>
+        <div id= "13">13</div>
+        <div id= "14">14</div>
+        <div id= "15">15</div>
+        <div id= "16">16</div>
+        <div id= "17">17</div>
+        </body></html>"""
+
+        self.assert_selector(
+            markup,
+            "div:nth-of-type(10)",
+            ['10'],
+            flags=util.XML
+        )
+
+        self.assert_selector(
+            markup,
+            "div:nth-child(10)",
+            ['10'],
+            flags=util.XML
+        )
+
+        self.assert_selector(
+            markup,
+            "div:nth-of-type(n+10)",
+            ['10', '11', '12', '13', '14', '15', '16', '17'],
+            flags=util.XML
+        )
+
+        self.assert_selector(
+            markup,
+            "div:nth-of-type(n+10)",
+            ['10', '11', '12', '13', '14', '15', '16', '17'],
+            flags=util.XML
+        )
+
     def test_nth_last_child(self):
         """Test `nth` last child."""
 

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest pytest-cov coverage lxml beautifulsoup4
apt-get update apt-get install -y gcc
3.9
requirements/project.txt requirements/tests.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
beautifulsoup4==4.13.3
coverage==7.8.0
exceptiongroup==1.2.2
html5lib==1.1
iniconfig==2.1.0
lxml==5.3.1
packaging==24.2
pluggy==1.5.0
pytest==8.3.5
pytest-cov==6.0.0
six==1.17.0
-e git+https://github.com/facelessuser/soupsieve.git@56daa95af36b964abf0ed0fc987bdbba87d92a67#egg=soupsieve
tomli==2.2.1
typing_extensions==4.13.0
webencodings==0.5.1

name: soupsieve
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - pip=25.0=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - beautifulsoup4==4.13.3
      - coverage==7.8.0
      - exceptiongroup==1.2.2
      - html5lib==1.1
      - iniconfig==2.1.0
      - lxml==5.3.1
      - packaging==24.2
      - pluggy==1.5.0
      - pytest==8.3.5
      - pytest-cov==6.0.0
      - six==1.17.0
      - tomli==2.2.1
      - typing-extensions==4.13.0
      - webencodings==0.5.1
prefix: /opt/conda/envs/soupsieve

tests/test_level3.py::TestLevel3::test_nth_child_issue_78
tests/test_level3.py::TestLevel3::test_attribute_begins tests/test_level3.py::TestLevel3::test_attribute_contains tests/test_level3.py::TestLevel3::test_attribute_end tests/test_level3.py::TestLevel3::test_attribute_namespace tests/test_level3.py::TestLevel3::test_attribute_namespace_xhtml tests/test_level3.py::TestLevel3::test_attribute_namespace_xml tests/test_level3.py::TestLevel3::test_checked tests/test_level3.py::TestLevel3::test_disabled tests/test_level3.py::TestLevel3::test_distant_sibling tests/test_level3.py::TestLevel3::test_empty tests/test_level3.py::TestLevel3::test_enable tests/test_level3.py::TestLevel3::test_first_of_type tests/test_level3.py::TestLevel3::test_last_child tests/test_level3.py::TestLevel3::test_last_of_type tests/test_level3.py::TestLevel3::test_namespace tests/test_level3.py::TestLevel3::test_not tests/test_level3.py::TestLevel3::test_nth_child tests/test_level3.py::TestLevel3::test_nth_last_child tests/test_level3.py::TestLevel3::test_nth_last_of_type tests/test_level3.py::TestLevel3::test_nth_of_type tests/test_level3.py::TestLevel3::test_only_child tests/test_level3.py::TestLevel3::test_only_of_type tests/test_level3.py::TestLevel3::test_root tests/test_level3.py::TestLevel3::test_target tests/test_level3.py::TestLevel3::test_undefined_namespace
docs/src/markdown/about/changelog.md soupsieve/css_parser.py
docs/src/markdown/about/changelog.md soupsieve/css_parser.py