Cached at:
05/29/26, 03:57 PM
# Emacs bra size calculator
Source: [https://pulusound.fi/blog/emacs-bra-size-calculator/](https://pulusound.fi/blog/emacs-bra-size-calculator/)
posted 2026\-05\-27, updated 2026\-05\-28
recently i needed some new bras\. my measurements had changed a bit since last time, so to make my life easier\(?\) i decided to write a bra size calculator that i can use in Emacs\. the core function,`my\-math\-compute\-bra\-size`, is as follows:
```
;; dependencies - these come with recent Emacs versions but might not be loaded
(require 'calc-units)
(require 'cl-lib)
(require 'seq)
(defun my-math-compute-bra-size (band-expr bust-expr &optional region)
(cl-flet ((to-unit (expr unit)
(string-to-number
(calc-eval (math-convert-units
(calc-eval expr 'raw)
(calc-eval unit 'raw)
t)))))
(let* ((region-info-alist
'((eu . ((unit . "cm")
(cups . ((12 . "AA") (14 . "A") (16 . "B") (18 . "C")
(20 . "D") (22 . "E") (24 . "F") (26 . "G")
(28 . "H") (30 . "I") (32 . "J") (34 . "K")))))
(uk . ((unit . "in")
(cups . ((1 . "AA") (2 . "A") (3 . "B") (4 . "C")
(5 . "D") (6 . "DD") (7 . "E") (8 . "F")
(9 . "FF") (10 . "G") (11 . "GG") (12 . "H")))))
(us . ((unit . "in")
(cups . ((1 . "AA") (2 . "A") (3 . "B") (4 . "C")
(5 . "D") (6 . "DD/E") (7 . "DDD/F") (8 . "DDDD/G")
(9 . "H") (10 . "I") (11 . "J") (12 . "K")))))))
(region (or region 'eu))
(region-info (alist-get region region-info-alist))
(unit (alist-get 'unit region-info))
(cups (alist-get 'cups region-info))
(band (to-unit band-expr unit))
(bust (to-unit bust-expr unit))
(diff (- bust band))
(cup (or (cdr (seq-find (lambda (x) (< diff (car x))) cups))
(format "%s+" (cdar (last cups))))))
(format "%s%s" (round band) cup diff))))
```
this makes use of Emacs Calc's built\-in unit conversion functions, so you need to pass in the measurements as unit\-suffixed strings\. for example, given a made\-up band \(underbust\) measurement of 90 cm and a bust measurement of 105 cm, you could calculate the EU bra size as
```
(my-math-compute-bra-size "90 cm" "105 cm" 'eu)
```
giving`"90B"`\. you could also use other units of length, such as`in`\(inches\), or`ly`\(light years\), or`Ang`\(Angstrom\)\. hooray for Calc\!
we can take this further with some nice UI around it\. i have recently enjoyed using[Org tables as spreadsheets](https://orgmode.org/worg/org-tutorials/org-spreadsheet-intro.html), and wanted to make a table where i can just type in my measurements, refresh, and have EU/UK/US bra sizes automatically filled in\.
this is not too difficult to achieve by[using Emacs Lisp as formulas](https://orgmode.org/worg/org-tutorials/org-spreadsheet-lisp-formulas.html)\. you can copy\-paste the following table as a template:
```
| date | band | bust | EU size | UK size | US size |
|------------+-------+--------+---------+---------+---------|
| 2026-05-27 | 90 cm | 105 cm | | | |
#+TBLFM: $4='(my-math-compute-bra-size $2 $3 'eu)::$5='(my-math-compute-bra-size $2 $3 'uk)::$6='(my-math-compute-bra-size $2 $3 'us)
```
modify the band and bust numbers \(again, with your preferred length units\!\),[update the table](https://orgmode.org/manual/Updating-the-table.html), for example with`C\-u C\-c \*`, and all the size fields get recomputed :\) you can also add more rows and keep a log of measurements over time, if you want to\.
disclaimers:
- i implemented support for EU, UK and US sizing as these are the ones i usually encounter\. other standards might need some additional logic\.
- there are larger cup sizes than the ones i entered, but the data i found on them was a bit inconsistent\. sorry\! for sizes that are out of range, the function will return the largest known size with a`\+`added\. it should hopefully be easy to augment the data if needed\.
- there may be mistakes in my data/code\.- i know in practice sizes vary by brand, model, etc\. but results from online calculators that i tried while writing this post vary so wildly that i now question whether these numbers really mean anything at all\. - i am reasonably confident my EU size calculation is consistent with[EN 13402](https://en.wikipedia.org/wiki/Joint_European_standard_for_size_labelling_of_clothes#Bra_sizes)though\.