Japan's hotel taxes are now different in every city: encoding the 2026–27 rules in plain JS
Japan doesn't have one hotel tax (宿泊税). It has a growing patchwork of prefectural and municipal ones, and in 2026–27 several of them change. Kyoto's top band went to ¥10,000 per person per night on 1 March 2026. Hokkaido
Japan doesn't have one hotel tax (宿泊税). It has a growing patchwork of prefectural and municipal ones, and in 2026–27 several of them change. Kyoto's top band went to ¥10,000 per person per night on 1 March 2026. Hokkaido added a prefectural tax on 1 April 2026 that stacks on top of city taxes like Sapporo's. Okinawa starts a 2% tax on 1 February 2027. Tokyo moves from flat amounts to 3% on 1 April 2027.
Travellers usually pay it at the hotel, on top of whatever they prepaid on a booking site (some booking sites collect it in advance). So I built a free, client-side calculator for a whole itinerary: Japan Hotel Tax Calculator 2026–27. You add stays (city, check-in date, nights, room price, guests, lodging type) and it gives the tax per night and the trip total. It's one plain JS file with no dependencies, and your stays are saved only in your browser's localStorage.
These are the parts that were harder than they looked.
1. Every rule is data, and every rule has a start date
The rate follows the night stayed, not the booking date. Tokyo's Q&A and Kyoto's FAQ both say so explicitly. So each city is a list of rules with a from date, and each night of a stay looks up its own rule:
{ id: 'tokyo', rules: [
{ from: MIN_DATE, kind: 'bands', bands: [[10000, 0], [15000, 100], [null, 200]], hotelOnly: true },
{ from: '2027-04-01', kind: 'percent', bp: 300, floorTo: 100, exemptBelow: 13000 }
]},
{ id: 'okinawa', rules: [
{ from: MIN_DATE, kind: 'none' },
{ from: '2027-02-01', kind: 'percent', bp: 200, floorTo: 1000, capBase: 100000 }
]}
bands are [upperExclusive, yen] pairs. percent covers Tokyo's new rule (3% of the per-person price rounded down to ¥100, nothing under ¥13,000), Okinawa's (2% of the price rounded down to ¥1,000, max ¥2,000) and Kutchan's (3% rounded down to ¥100, Hokkaido tax included). Those three "round the price down first" rules are easy to miss. In Tokyo from April 2027, ¥13,550 becomes ¥13,500 × 3% = ¥405.
Example: a 4-night Tokyo stay from 29 March 2027, ¥30,000 for a room for two (¥15,000 each), is ¥400, ¥400, ¥400, then ¥900 on the night of 1 April. The calculator warns when a stay spans a change.
Dates are plain calendar strings ('2027-04-01'). All the arithmetic is done with Date.UTC, so the result doesn't depend on the visitor's time zone. The test suite runs under TZ=Asia/Tokyo, America/Los_Angeles, Pacific/Kiritimati and UTC to make sure.
2. Band edges need exact fractions, not floats
The bands are defined on the per-person price excluding the 10% consumption tax. People usually know the price for the whole room, often tax-inclusive. The obvious conversion is price / 1.1 / guests, and it's wrong exactly where it matters:
6600 / 1.1 // 5999.999999999999 -> Kyoto ¥200 band (should be ¥400)
55000 / 1.1 // 49999.99999999999 -> Kyoto ¥1,000 band (should be ¥4,000)
14300 / 1.1 // 12999.999999999998 -> Tokyo 2027: exempt (should be ¥390)
¥6,600 including tax is exactly ¥6,000, which is Kyoto's ¥400 band edge. So I keep the price as a fraction and compare with integer multiplication:
function personPrice(price, opts) {
var num = opts.inclTax ? price * 10 : price; // incl. 10% tax -> x 10/11
var den = (opts.inclTax ? 11 : 1) * (opts.perRoom ? opts.guests : 1);
return { num: num, den: den };
}
function lt(f, yen) { return f.num < yen * f.den; } // price < edge, exactly
function floorTo(f, unit) { return Math.floor(f.num / (f.den * unit)) * unit; }
The tests pin the edges from both sides. ¥22,000 incl. tax is exactly ¥20,000 and must hit Kyoto's ¥1,000 band, while ¥21,999 stays at ¥400. A ¥26,000 Tokyo room for two in June 2027 is ¥13,000 each and is taxed. ¥25,999 isn't.
Read the official wording for each edge carefully too. Niseko's lowest band is "5,001円未満" (up to ¥5,000), not "under ¥5,000", so its first edge in the data is 5001.
3. Generate the page's rate table from the same JS
The tool page and a companion blog post both show a full rates table. I didn't want to type the rates twice, because a table that disagrees with the calculator is worse than no table. The static site builder (Python) runs Node to load the calculator module and renders the table from its exported data:
out = subprocess.run(["node", "-e",
"process.stdout.write(JSON.stringify(require(process.argv[1])))", str(HTAX_JS_PATH)],
check=True, capture_output=True, text=True).stdout
data = json.loads(out) # CITIES, rules, labels, SOURCES -> HTML table + source list
The same file is also inlined into the page as <script id="htax-js">, and a test checks that the inlined copy is byte-identical to the source. The page can't drift from the module without the build or the test catching it.
4. Test against numbers typed from the official pages
If the test reads its expected values from the calculator's own data table, it only proves that the code agrees with itself. So the expected values are a separate table typed in from the official government pages: [date, per-person price, expected yen] for every city, at both sides of every band edge, and on both sides of every rule-change date (2026-03-01, 2026-04-01, 2027-02-01, 2027-04-01). There are also whole-trip cases that span those dates. The suite has 618 checks, and it runs against both the module and the copy inlined in the built HTML.
Rereading the official pages for those tables also fixed my wording: my notes said the tax is "paid at check-in, not in the booking price", but Kyoto's leaflet and Osaka's guest page say some booking sites collect it. The tool now says "usually".
5. Know what you don't cover, and say so
Each city's rules carry the source URLs, and the page lists them. Anything I couldn't verify on an official page was left out rather than guessed. Akaigawa in Hokkaido is excluded, Niseko and Kutchan nights before 1 April 2026 show as "not covered", and nights before 2026 are out of range everywhere. An "uncovered" night is reported, not counted as ¥0.
Some city-specific rules end up as notes rather than math. In Kyoto, booking-site points don't lower the taxable price (Kyoto's FAQ Q3). In Tokyo, hostels and minpaku are only included from 1 April 2027.
If you're planning a Japan trip, or want to see the fraction and date handling in action, try the calculator linked at the top. There's an example trip button that crosses Tokyo's April 2027 change. Corrections against official sources are very welcome in the comments.
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.