A lightweight, zero-dependency web application for converting between common units of measurement — no server, no build step required.
- Three conversion categories — Length, Weight, and Temperature
- Instant results — conversions are calculated client-side in the browser
- Swap button — reverse the From/To units in one click
- Quick-fill chips — tap a common conversion to pre-fill and auto-convert
- Keyboard support — press Enter in the value field to convert
- Reset — clear the form and result with a single button
| Category | Units |
|---|---|
| Length | Millimeter, Centimeter, Meter, Kilometer, Inch, Foot, Yard, Mile |
| Weight | Milligram, Gram, Kilogram, Ounce, Pound |
| Temperature | Celsius, Fahrenheit, Kelvin |
index.html # Markup — page structure and UI
style.css # Styles — layout, theme, and animations
script.js # Logic — unit data, conversion functions, and DOM interactions
README.md # This file
No installation or build process is needed. All three files must be kept in the same directory. Open index.html in a browser:
open index.htmlOr serve the directory with any static file server (required if your browser blocks local file imports):
npx serve .
# then visit http://localhost:3000- Select a category tab — Length, Weight, or Temperature.
- Enter the value you want to convert in the input field.
- Choose the From and To units using the dropdowns.
- Click Convert (or press Enter) to see the result.
- Use the ⇄ button to swap the two units.
- Click a quick conversion chip to auto-fill a common conversion.
- Click Reset to start over.
Conversions are performed by reducing the input to a common base unit and then scaling to the target unit — meters for length, grams for weight, and Celsius for temperature (using the standard algebraic formulas). All logic lives in script.js and runs entirely in the browser with no network requests.
Works in all modern browsers (Chrome, Firefox, Safari, Edge). No polyfills required.