Toolbox-XToolbox-X

Handle Roman Numerals

Convert between integers and Roman numerals (1-3999).

convertToRomanNumerals

Converts any valid integer from 1 to 3999 into its equivalent Roman numeral representation.

Function Signature

function convertToRomanNumerals(value: Numeric): RomanCapital

Parameters

  • value (Numeric): The numeric input (either number or numeric string) to be converted.

Return Value

  • RomanCapital: A string representing the uppercase Roman numeral form of the value.

Throws

  • RangeError: If the number is not an integer or is less than 1 or greater than 3999.

Example Usage

playground.ts

Aliases

The following aliases can be used for the convertToRomanNumerals function:

  • toRoman
  • numberToRoman
  • arabicToRoman
  • integerToRoman
  • numericToRoman
  • toRomanNumeral

romanToInteger

Converts any valid Roman numeral from I to MMMCMXCIX (13999) into its equivalent Arabic integer representation.

Function Signature

function romanToInteger(roman: LooseRomanNumeral): number

Parameters

  • roman (LooseRomanNumeral): The Roman numeral input (case-insensitive) to be converted.

Return Value

  • number: The integer form of the Roman numeral.

Throws

  • TypeError: If the input is not a non-empty string.
  • Error: If the Roman numeral contains invalid characters or is malformed.
  • RangeError: If the resulting number is less than 1 or greater than 3999.

Example Usage

playground.ts

Aliases

The following aliases can be used for the romanToInteger function:

  • romanToArabic
  • romanToNumeric
  • convertRomanToArabic
  • convertRomanToNumeric
  • convertRomanToInteger

Types

RomanCapital

type RomanCapital = string; // Uppercase Roman numeral representation

LooseRomanNumeral

type LooseRomanNumeral = string; // String representing a Roman numeral

Last updated: Sun, Jun 14, 2026 07:06:16AM (UTC)

On this page