Other Calculators

Find Your Perfect Hat Size

Easily calculate your hat size based on head circumference.

Hat Size Calculator

Table of contents

Accurate Hat Size Calculator
Formula
How to use
FAQ

Accurate Hat Size Calculator

This calculator helps you determine your hat size based on the circumference of your head. Knowing your hat size is essential for finding comfortable and well-fitting headwear. This tool is particularly useful for individuals who struggle to find hats that fit properly or for those purchasing hats online.

To use the calculator, simply measure the circumference of your head in centimeters. The calculator will then provide you with the corresponding hat size. This ensures that you get a hat that fits well, enhancing comfort and style.

Formula

The formula used in this calculator checks if the circumference is within the valid range of 30 cm to 70 cm. If the circumference is valid, it returns the circumference as the hat size; otherwise, it returns NaN (not a number) to indicate an invalid input.

How to use

  1. Measure the circumference of your head in centimeters.
  2. Input the circumference value into the calculator.
  3. Click the calculate button to find your hat size.

FAQ

What if my measurement is less than 30 cm?

If your measurement is less than 30 cm, it is considered invalid for hat sizing, and the calculator will return NaN.

What if my measurement is more than 70 cm?

If your measurement exceeds 70 cm, it is also considered invalid, and the calculator will return NaN.

How can I ensure an accurate measurement?

Use a flexible measuring tape and wrap it around the widest part of your head, just above your ears, for the most accurate measurement.

FORMULA RULES (strict — the formula compiles to a single JS function the page runs):

  • Identifiers on either side MUST exactly match the camelCase names you declared in inputs/outputs.
  • Every output[].name MUST appear on the LEFT side of a "name = expression" line.
  • Use ^ for powers (e.g. (1+r)^n) OR pow(x, y).
  • Allowed math functions: sqrt abs sin cos tan log ln exp pi pow min max round floor ceil sign random.
  • No comments, no "where ..." clauses, no if/else/ternary, no string outputs, no Σ, no subscripts, no arrays, no recursion.
  • Single-step computation only. If conditional logic is needed, use boolean arithmetic: (cond > 0) exprA + (cond <= 0) exprB.
  • The bug context lists what the legacy version got wrong. FIX IT.
  • 2-5 inputs typical; outputs are plain numbers.