| Consolidated Statements of Stockholders' Equity (Parenthetical) - $ / shares | 12 Months Ended | ||
|---|---|---|---|
| Jun. 30, 2023 | Jun. 30, 2022 | Jun. 30, 2021 | |
| Statement of Stockholders' Equity [Abstract] | |||
| Cash dividends declared (in dollars per share) | $ 5.20 | $ 4.20 | $ 3.60 | 
| X | ||||||||||
| 
- Definition Aggregate dividends declared during the period for each share of common stock outstanding. Reference 1: http://fasb.org/us-gaap/role/ref/legacyRef 
 | 
| X | ||||||||||
| 
- References No definition available. 
 |