Skip to content
Solar Account.
Finance & Investing

How to Download Historical Stock Data for Free

You can download historical stock data for free using web finance portals, spreadsheet formulas, or developer-focused Application Programming Interfaces (APIs). Web portals like Yahoo Finance allow instant CSV file downloads for individual tickers, while Googl...

How to Download Historical Stock Data for Free

You can download historical stock data for free using web finance portals, spreadsheet formulas, or developer-focused Application Programming Interfaces (APIs). Web portals like Yahoo Finance allow instant CSV file downloads for individual tickers, while Google Sheets (GOOGLEFINANCE) and Microsoft Excel (STOCKHISTORY) offer dynamic, built-in functions. For automated or large-scale technical analysis, Python libraries such as yfinance and free API tiers from Alpha Vantage or Polygon.io provide programmatic access.

Contents

Key Considerations Before Downloading Market Data

Before pulling market datasets into your environment, you must determine the structure, granularity, and historical depth required for your financial model or trading system. Historical equity data generally falls into two primary categories: end-of-day (EOD) data and intraday data. End-of-day data includes daily summary values for a security, whereas intraday data captures price movements within a single trading session across minute, five-minute, or hourly intervals.

Most free sources limit intraday historical access to recent windows (such as 30 to 60 days of historical minute bars), while providing decades of daily historical data. Understanding these technical parameters ensures you select a source compatible with your analysis pipeline.

Understanding OHLCV and Adjusted Metrics

Historical equity files are structured as tabular data containing Open, High, Low, Close, and Volume (OHLCV) values:

How To Download Historical News Data With News API?
  • Open: The security's opening price for the trading period.
  • High: The maximum price traded during the period.
  • Low: The minimum price traded during the period.
  • Close: The final trading price before the market close.
  • Volume: The total number of shares traded during the period.
  • Adjusted Close: The closing price modified to reflect corporate actions, specifically stock splits and dividend distributions.

When building backtests, financial models, or charting applications, relying solely on raw closing prices introduces significant distortion. For example, if a stock undergoes a 2-for-1 stock split, the raw historical price halves overnight, creating a false drop on a price chart. The Adjusted Close retroactively recalibrates historical prices to account for splits and payouts, giving an accurate representation of absolute total return.

Method 1: Exporting Stock Data Directly via Web Portals

For fast, non-programmatic access to historical price histories, browser-based financial portals remain the most accessible option. They require no programming knowledge and generate structured CSV or Excel spreadsheets in seconds.

  1. Search Ticker Symbol (e.g., AAPL)
  2. Select Date Range & Granularity (Daily, Weekly, Monthly)
  3. Click "Apply", then click "Download" to generate .CSV file

Yahoo Finance Direct CSV Export

Yahoo Finance remains a widely used web tool for manual data downloads due to its global market coverage and long historical depth.

  1. Navigate to the Yahoo Finance website and enter the target ticker symbol (such as AAPL or MSFT) into the search bar.
  2. Click on the Historical Data tab located on the quote summary menu.
  3. Select your desired Time Period (e.g., 1 Year, 5 Years, or Max), choose the Frequency (Daily, Weekly, or Monthly), and select Historical Prices under the Show dropdown menu.
  4. Click the Apply button to refresh the table.
  5. Select the Download link positioned directly above the data grid to export a .csv file straight to your local directory.

Investing.com and Nasdaq Historical Downloads

Alternative portals offer specialized datasets, such as index components or exchange-specific listings.

  • Investing.com: Provides broad access to international markets, commodities, and sovereign bond yields. To download data, register for a free account, search for the asset, navigate to the Historical Data tab, set the date range, and click Download Data.
  • Nasdaq.com: Offers official daily pricing files for US equities. Search for any listed asset, select Historical Quotes from the left menu, select a timeframe up to 10 years, and download the dataset directly as a CSV file.

Method 2: Automating Downloads in Spreadsheets (Google Sheets & Excel)

Spreadsheets allow financial analysts to build dynamic dashboards that update automatically without manually downloading and importing individual CSV files.

Using Google Sheets (GOOGLEFINANCE)

Google Sheets features a built-in function called =GOOGLEFINANCE(), which fetches real-time and historical market metrics directly from Google's financial repository.

Syntax:

=GOOGLEFINANCE(ticker, [attribute], [start_date], [end_date|num_days], [interval])

Example Implementation:

To pull daily historical closing prices for Apple Inc. for the entire calendar year 2025, enter the following formula into cell A1:

=GOOGLEFINANCE("AAPL", "close", DATE(2025, 1, 1), DATE(2025, 12, 31), "DAILY")

Google Sheets populates a two-column array containing dates and closing prices. You can replace "close" with "all" to retrieve the complete daily OHLCV dataset.

Date Close
2025-01-02 16:00:00 243.25
2025-01-03 16:00:00 245.10
... ...

Using Microsoft Excel (STOCKHISTORY)

Microsoft Excel (for Microsoft 365 users) includes a native dynamic array function called =STOCKHISTORY(). This function connects directly to MSN Money financial feeds.

Syntax:

=STOCKHISTORY(stock, start_date, [end_date], [interval], [headers], [properties...])

Example Implementation:

To download historical daily data for Microsoft Corporation for the year 2025, input:

=STOCKHISTORY("MSFT", DATE(2025, 1, 1), DATE(2025, 12, 31), 0, 1, 0, 1, 2, 3, 4, 5)

The numerical parameters dictate the columns displayed: Date (0), Close (1), Open (2), High (3), Low (4), and Volume (5). The array automatically dynamic-spills into adjacent cells.

Method 3: Fetching Data Programmatically with Python

For quantitative research, algorithmic trading backtests, and machine learning pipelines, programmatically pulling historical data into a Python workspace is standard practice.

Downloading Data via yfinance

The yfinance library is an open-source Python tool that extracts historical market data by querying Yahoo Finance public endpoints. It returns structured pandas DataFrames, making it convenient for financial data analysis.

Installation:

pip install yfinance pandas matplotlib

Python Script Example:

import yfinance as yf import pandas as pd # Define ticker symbol and target date range ticker_symbol = "NVDA" start_date = "2024-01-01" end_date = "2025-12-31" # Fetch historical data nvda_data = yf.download(ticker_symbol, start=start_date, end=end_date) # Display the top 5 records of the dataset print(nvda_data.head()) # Save dataset to a local CSV file nvda_data.to_csv("NVDA_historical_data.csv")

The resulting nvda_data DataFrame includes Open, High, Low, Close, Adj Close, and Volume. The script formats date stamps as the DataFrame index for simple time-series analysis and plotting.

Method 4: Utilizing Free-Tier Financial APIs for Developers

Dedicated financial data APIs provide structured JSON payload responses, higher uptime guarantees, and clear rate limits compared to web scraping or unofficial endpoints.

DATA SOURCE DAILY API LIMIT HISTORICAL DEPTH
Alpha Vantage 25 requests/day 20+ years (EOD)
Polygon.io 5 requests/min 2+ years (Historical)
FMP (Financial) 250 requests/day 5 years (EOD Free Tier)

1. Alpha Vantage

Alpha Vantage provides RESTful APIs for stock metrics, foreign exchange (FX), and digital currencies. Its free tier offers end-of-day and limited intraday datasets.

  • Free Tier Allocation: 25 requests per day.
  • Data Structure: JSON payload or direct CSV output via REST parameters.
  • Primary Endpoint: TIME_SERIES_DAILY_ADJUSTED.
  • Best For: Users seeking long-term historical EOD data who only need to update datasets periodically.

2. Polygon.io

Polygon.io provides market data across equities, options, and crypto. It offers robust infrastructure and clear developer documentation.

  • Free Tier Allocation: 5 API calls per minute.
  • Data Structure: Structured JSON object feeds with explicit split/dividend metadata.
  • Historical Depth: Up to 2 years of historical data on the free tier.
  • Best For: Developer applications requiring clean data structures and modern WebSocket/REST API design.

3. Financial Modeling Prep (FMP)

Financial Modeling Prep is a broad financial data platform offering corporate statements, real-time quotes, and stock market price histories.

  • Free Tier Allocation: 250 requests per day (requires free API registration).
  • Data Structure: RESTful JSON arrays.
  • Best For: Projects combining market prices with company fundamentals, such as P/E ratios, income statements, and cash flow reports.

Comparing Free Historical Stock Data Sources

Selecting the optimal data retrieval method depends on your execution environment, technical skill set, download volume, and analytical goals:

Provider / Tool Access Method Data Granularity Historical Depth Rate Limits / Constraints Best Suited For
Yahoo Finance Web Manual Browser Download Daily, Weekly, Monthly Full Asset History (Decades) Manual exports; potential IP throttling on heavy web scraping One-off analyses, offline Excel models
Google Sheets =GOOGLEFINANCE() Formula Daily, Intraday (delayed) Up to 1-2 Decades Function call limits per spreadsheet sheet Dynamic live spreadsheets, lightweight tracking
Microsoft Excel =STOCKHISTORY() Formula Daily, Weekly, Monthly Variable (MSN data source) Requires Microsoft 365 subscription Financial modeling, desktop spreadsheet workflows
yfinance (Python) Open-source Python Package Daily, Intraday (Max 60d) Decades (Daily) Unofficial API; dependent on site structure changes Data science pipelines, Python backtesting
Alpha Vantage REST API (JSON/CSV) Intraday, Daily 20+ Years 25 API requests per day Quantitative developer prototypes
Polygon.io REST API (JSON) Intraday, Daily 2 Years (Free Tier) 5 API requests per minute limit API-driven web applications

Data Pitfalls, Adjustments, and Rate Limits

While free data options lower the barrier to financial analysis, unverified datasets can introduce errors into quantitative trading models or financial disclosures.

  • Look-Ahead Bias: Using unadjusted close prices across split dates
  • Survivor Bias: Ignoring delisted companies in historical lists
  • Rate Limiting: Exceeding API request quotas (HTTP 429 Errors)

Unadjusted vs. Adjusted Prices

Failing to account for stock splits and cash dividends is a frequent source of error in backtesting. If a company executes a 10-for-1 stock split, historical close figures that are not split-adjusted will show a artificial 90% drop in valuation. Always check whether your downstream analysis requires raw prices (useful for execution analysis) or Adjusted Close values (necessary for calculating total returns).

Survivorship Bias in Free Datasets

Free historical datasets typically maintain data for currently active securities. Equities that underwent bankruptcy, liquidations, or private takeovers are often removed from active ticker indexes. If you test an investment strategy exclusively against currently listed S&P 500 companies using historical datasets, your results will suffer from survivorship bias, skewing overall performance figures upward.

Handling API Throttling and HTTP 429 Errors

Free API services enforce rate limits to protect infrastructure. Exceeding allowed request counts triggers HTTP 429 (Too Many Requests) status codes.

To prevent rate limits from interrupting python scripts or data retrieval pipelines:

  • Implement explicit time delays using Python's time.sleep() function between API requests.
  • Cache retrieved historical CSV files locally on disk to avoid downloading identical historic datasets repeatedly.
  • Use exponential backoff retry logic to handle temporary rate limits or dropped connections gracefully.

Recommended Workflow: Selecting Your Data Strategy

Choose the data retrieval approach that best aligns with your technical setup and research requirements:

  1. For Non-Technical Analysts and Quick Lookup: Use Yahoo Finance Direct Export or Nasdaq.com. These portals provide clean CSV downloads without setup overhead.
  2. For Ongoing Spreadsheet Dashboards: Implement Google Sheets (=GOOGLEFINANCE) or Excel (=STOCKHISTORY). These native formulas keep models updated without requiring manual CSV updates.
  3. For Data Science and Algorithmic Research: Use Python with yfinance. This approach integrates directly with data tools like pandas, numpy, and scikit-learn for rapid prototyping.
  4. For Software Developers Building Production Applications: Register for a free API key with Polygon.io or Alpha Vantage. Structured JSON formats, version control, and clear API documentation make them suitable choices for software development.

Frequently Asked Questions

Can I download intraday historical stock data for free?

Yes, but historical depth for intraday intervals (such as 1-minute or 5-minute charts) is limited on free tiers. The yfinance Python library provides up to 60 days of historical minute data. Polygon.io and Alpha Vantage also offer intraday endpoints, though historical access on free plans is restricted compared to their daily datasets.

What is the difference between Close and Adjusted Close prices?

The Close price reflects the actual trading price at market close on that specific calendar date. The Adjusted Close modifies historical closing prices to account for corporate actions, such as stock splits, reverse splits, and cash dividend payouts. Adjusted prices are essential when measuring true historical investment performance.

Is free historical stock data permitted for commercial use?

Most free stock data providers (including Yahoo Finance web scrapes and free API tiers) restrict usage to personal, educational, or non-commercial projects. Commercial applications, trading platforms, or public financial services typically require data licensing agreements directly from underlying stock exchanges (e.g., NYSE or Nasdaq) to remain compliant.

Why does my Python script return empty DataFrames when requesting data?

Empty DataFrames usually result from invalid ticker symbols, misformatted date strings (which should follow YYYY-MM-DD), requesting data for non-trading days (weekends or market holidays), or hitting rate limits imposed by the host provider.

What is the easiest way to download 10 years of stock data into Excel?

The simplest approach is opening Yahoo Finance, searching the desired ticker symbol, setting the historical date range filter to 10 Years, and clicking Download. Opening the downloaded .csv file directly in Microsoft Excel gives you instant access to 10 years of daily OHLCV data.

Written by

Elizabeth Ward

Real Estate & Housing Analyst