HAFAS Bitmask Calculator

HAFAS Bitmask Calculator

Web Demo

This is a simple web-based tool to help you decode and encode bitmasks used by the HAFAS (HaCon Fahrplan-Auskunfts-System) API.
It visually maps a decimal bitmask to the transport modes it represents and vice versa.

πŸ” What is HAFAS?

HAFAS is a timetable and journey planning system widely used across European transport networks, including:

In HAFAS APIs, transport modes (ICE trains, buses, trams, ferries, etc.) are often encoded in a bitmask β€”
a single number where each bit (1, 2, 4, 8, …) represents a specific type of transport.


✨ Features

  • πŸ”’ Enter a number to decode it into selected transport modes
  • βœ… Click transport icons to encode a bitmask value
  • πŸ”„ Switch between different mode sets (DB, SaarVV, Luxembourg, HAFAS client spec)
  • ⚠️ Input capped to valid 11-bit range (0–2047)
  • πŸ’‘ Uses the official hafas-client mode bitmask as one profile

πŸ›  Technology

  • React + Vite
  • Plain CSS for styling
  • No external UI libraries
  • Fully static β€” can be deployed to GitHub Pages, Netlify, etc.

Structure

directory
1
2
3
4
.
β”œβ”€β”€ assets # static scripts and assets for demo
β”œβ”€β”€ index.html # demo entry
└── react # react source code

hafas-client – JavaScript client for HAFAS public transport APIs.
Mobiliteit.lu – Real-Time tracking of bus lines across Luxembourg

Author

Alex Li

Posted on

2025-04-30

Updated on

2025-05-13

Licensed under

Comments

Your browser is out-of-date!

Update your browser to view this website correctly.&npsb;Update my browser now

Γ—