How to calculate values and format numbers in templates
Hubhus includes built-in calculators for performing math and percentage calculations directly in templates, booking forms, automations, and HTML components — without external code.
TL;DR
Simple calc: @calc[(2+2)*3]@endcalc. Formatted calc: <hh-calculator precision="2" decimalSeparator=",">(1250.75 + 249.25) / 2</hh-calculator>. Percentage: <hh-calculator.percentage>25% of %lead_price%</hh-calculator.percentage>. Number format: <hh-number.format input-decimal-separator="." output-decimal-separator="," decimals="2" />. Use with lead field placeholders for dynamic pricing.
4 calculation tools
@calc — basic calculation
The simplest calculator. Supports +, -, *, /, and parentheses. Example: @calc[(%lead_price% * 1.25)]@endcalc — multiply price by 1.25 (add 25% VAT). Output is raw number without formatting. Use when you only need the value without decimal control.
hh-calculator — formatted calculation
Supports the same operations as @calc but with precision and formatting control. Attributes: precision="2" (decimal places), decimalSeparator="," (Danish comma), thousandsSeparator=".". Example:<hh-calculator precision="2" decimalSeparator=",">%lead_price% + %lead_fee%</hh-calculator>Use for currency output in emails and webpages.
hh-calculator.percentage — percentage calculations
Specialized for percentage expressions. Supports: "x% of y", "x% discount on y", "Add x% to y". Example:<hh-calculator.percentage precision="2" decimalSeparator=",">25% of %lead_price%</hh-calculator.percentage>Ideal for VAT calculations, discounts, commissions, and dynamic quotes.
hh-number.format — number formatting
Format an existing numeric value without calculating. Attributes: input-decimal-separator, output-decimal-separator, decimals. Example:<hh-number.format input-decimal-separator="." output-decimal-separator="," decimals="2">%lead_price%</hh-number.format>Use to ensure consistent currency display when the stored value uses a different decimal format.
Common searches
calculate price • format number • hh-calculator • percentage calculation • VAT calculation • decimal separator • currency format • @calc
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article