Ordinal to Integer Converter

Converts a list of English ordinal strings (one per line), like "1st", "2nd", or "21st", back into plain integers, validating that each suffix actually matches its number per English ordinal rules (rejecting mismatches like "21th"). A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-27

Overview

Introduction

This tool parses English ordinal strings like "1st", "2nd", "3rd", and "21st" back into their plain integer values, while double-checking that each one uses the grammatically correct suffix.

It's the reverse of the Integer to Ordinal Converter, and unlike a simple suffix-stripping approach, it actively rejects malformed ordinals such as "21th" or "2st".

What Is Ordinal to Integer Converter?

A converter that takes a list of ordinal strings, one per line, and outputs the plain integer each one represents, after validating the suffix.

It applies the same English ordinal suffix rules (including the 11th/12th/13th exceptions) in reverse, to check correctness rather than assume it.

How Ordinal to Integer Converter Works

Each line is matched against a pattern of one or more digits followed by "st", "nd", "rd", or "th" (case-insensitive).

The tool computes what the correct suffix should be for that specific number, using the same modulo-100 and last-digit logic as the forward converter.

If the provided suffix doesn't match the computed correct one, the line is rejected with an error explaining the mismatch; otherwise, the plain number is returned.

When To Use Ordinal to Integer Converter

Use it to parse ordinal text (like "3rd place" or "the 21st") back into a number you can sort, compare, or calculate with.

It's also useful for validating that ordinal strings elsewhere in your data use correct English grammar.

Features

Advantages

  • Catches grammatically incorrect ordinals instead of silently accepting any suffix.
  • Reuses the same correct suffix rule (including the teens exception) as the forward converter, so the two tools stay consistent.

Limitations

  • Only understands English ordinal suffixes; ordinals from other languages aren't supported.
  • Requires the ordinal to be written with digits (like "21st"), not spelled out (like "twenty-first").

Examples

Valid ordinal

Input

21st

Output

21

Mismatched suffix

Invalid input

21th

Parser error

Error: wrong suffix

21 should end in "st", not "th", so this line is rejected rather than silently accepted.

Corrected version

21st

Best Practices & Notes

Best Practices

  • If you're generating ordinal strings programmatically to feed into this tool, use the companion Integer to Ordinal Converter so the suffixes are always correct.

Developer Notes

The validation reuses the exact same suffix-selection logic as the Integer to Ordinal Converter (checking `n % 100` for the 11-13 exception, then `n % 10` otherwise) and compares it against the parsed suffix, so both tools agree on what counts as "correct".

Ordinal to Integer Converter Use Cases

  • Parsing ordinal text like "3rd" or "21st" back into a sortable or computable number
  • Validating that ordinal strings in a dataset use grammatically correct suffixes
  • Checking round-trip correctness against the Integer to Ordinal Converter

Common Mistakes

  • Assuming any suffix will be accepted for a given number; only the grammatically correct one passes.
  • Entering a spelled-out ordinal like "twenty-first" instead of the digit form "21st".

Tips

  • If a line is rejected, check whether the number falls in the 11-13 (or 111-113, etc.) exception range before assuming the suffix is simply wrong.

References

Frequently Asked Questions