Skip to content

imo

Validates an IMO (International Maritime Organization) ship number.

Options

OptionTypeDefaultDescription
messagestringlocale defaultCustom error message

Playground

Valid values

ValueNotes
"IMO 1234567"Standard IMO format

Invalid values

ValueReason
"IMO 1234568"Fails weighted checksum
"IMO 123456"Only 6 digits after prefix

Notes

  • Empty string ("") always returns valid: true. Combine with notEmpty to require a value.
  • Format must be "IMO NNNNNNN" (the "IMO " prefix is required). The check digit is a weighted sum of the first 6 digits.

Released under the MIT License.