Debt to Equity Ratio
Calculate the debt to equity ratio, a solvency ratio that measures the proportion of a company’s equity that is financed by debt. This ratio is also known as the Gearing Ratio.
The debt to equity ratio, for short the D/E ratio, indicates the relative contribution of debt and equity to a company’s capital structure. It helps assess the level of financial risk a company carries due to its debt obligations. A higher ratio implies a higher reliance on debt to finance the business, which could increase risk but also potentially lead to higher returns for shareholders.
The formula is as follows:
\[\text{Debt to Equity Ratio} = \text{Total Debt} / \text{Total Equity}\]Also known as: D/E ratio, leverage ratio, gearing ratio.
No programming experience? With the Finance Toolkit MCP server, AI assistants such as Claude and ChatGPT can calculate the Debt to Equity Ratio for you. Just ask in plain English.
Calculate the Debt to Equity Ratio in Python
The Debt to Equity Ratio is available in the Ratios module of the open-source Finance Toolkit. Install it with:
pip install financetoolkit -U
Then call get_debt_to_equity_ratio as shown below.
from financetoolkit import Toolkit
toolkit = Toolkit(["AAPL", "TSLA"], api_key="FINANCIAL_MODELING_PREP_KEY")
debt_to_equity_ratios = toolkit.ratios.get_debt_to_equity_ratio()
Which returns:
| 2021 | 2022 | 2023 | 2024 | 2025 | |
|---|---|---|---|---|---|
| AAPL | 2.1639 | 2.6145 | 1.9942 | 2.0906 | 1.5241 |
| TSLA | 0.2809 | 0.1252 | 0.1505 | 0.1849 | 0.1011 |
Parameters
get_debt_to_equity_ratio accepts the following parameters:
- rounding (int, optional): The number of decimals to round the results to. Defaults to 4.
- growth (bool, optional): Whether to calculate the growth of the ratios. Defaults to False.
- lag (int | str, optional): The lag to use for the growth calculation. Defaults to 1.
- standardize (bool, optional): Whether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False.
- trailing (int): Defines whether to select a trailing period. E.g. when selecting 4 with quarterly data, the TTM is calculated.
Related Solvency Ratios
The Ratios module page introduces the module, and the sidebar lists all of its functions.