October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
VGSources
Blog

hg.dll Missing: Repair MATLAB Graphics Safely on Windows

Length10 min Posted Quest giverVGSources Team

Start with this diagnostic checklist

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Before changing Windows files, answer these three questions:

  1. Which program fails? Is it MATLAB, or a standalone application built with MATLAB Compiler?
  2. When does it fail? Does the program refuse to start, or does MATLAB open but fail during plotting, graphics initialization, or App Designer use?
  3. Which architecture and release are involved? Check whether the application is 32-bit or 64-bit, and identify the MATLAB or MATLAB Runtime release it expects.

hg.dll is a MATLAB Handle Graphics component published by The MathWorks. It is not a Windows system DLL, and Windows does not normally install it.

The safest repair is to restore the complete MATLAB installation or install the matching MATLAB Runtime release. Do not download a loose copy of hg.dll, place it in System32, or run regsvr32 against it.

What hg.dll does and where it belongs

hg.dll supports MATLAB graphics and Handle Graphics features. A normal MATLAB installation may contain it in a path similar to:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Microsoft Windows 11 (USB)
  • Less chaos, more calm. The refreshed design of Windows 11 enables you to do what you want effortlessly.
  • Biometric logins. Encrypted authentication. And, of course, advanced antivirus defenses. Everything you need, plus more, to protect you against the latest cyberthreats.
  • Make the most of your screen space with snap layouts, desktops, and seamless redocking.
  • Widgets makes staying up-to-date with the content you love and the news you care about, simple.
  • Stay in touch with friends and family with Microsoft Teams, which can be seamlessly integrated into your taskbar. (1)
C:Program FilesMATLABR2021abinwin64hg.dll

A MATLAB Runtime installation may contain it in a path similar to:

C:Program FilesMATLABMATLAB Runtimev96binwin64hg.dll

The exact release and folder vary. Older installations may use win32, while current Windows deployments commonly use win64. The application, MATLAB release, runtime release, and architecture must agree.

The error may mention hg.dll even when that file is still present. MATLAB graphics also needs resource files such as:

toolbox/matlab/graphics/core/hg/hgrc.m

If that resource is missing, the installation is damaged, the MATLAB search path is wrong, or an upgrade removed files from the older installation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Fix 1: Identify whether MATLAB or MATLAB Runtime is required

If MATLAB itself fails

Use the MATLAB release that was installed on the computer. Do not copy hg.dll from another release.

  1. Close MATLAB and any MATLAB-based applications.
  2. Open File Explorer.
  3. Browse to:

text
C:Program FilesMATLAB

  1. Open the folder for the affected release.
  2. Check whether binwin64hg.dll exists.
  3. If MATLAB opens, test graphics by running a simple plot.
  4. If plotting or startup still fails, proceed to a repair or reinstall of that same release.

If MATLAB was upgraded recently, do not assume the newest installation is complete. A missing hgrc.m file or an incorrect path can cause graphics initialization errors after an upgrade.

If a standalone application fails

A compiled MATLAB application generally needs MATLAB Runtime rather than the full MATLAB product.

Check the application’s readme.txt, installer, documentation, or publisher instructions for:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • The MATLAB release used to compile it
  • The required MATLAB Runtime release
  • Whether the application is 32-bit or 64-bit
  • Any required runtime path configuration

Install the matching MATLAB Runtime release from the official MathWorks MATLAB Runtime download page. A newer, unrelated runtime release is not automatically a substitute.

Several MATLAB Runtime releases can coexist. That is normal, but the application must find the one it was built to use.

Fix 2: Repair or reinstall MATLAB

This is the most likely fix when MATLAB itself reports hg.dll, graphics initialization, or hgrc.m errors.

Windows 11

  1. Save your MATLAB work and close MATLAB.
  2. Select Start > Settings > Apps > Installed apps.
  3. Search for MATLAB.
  4. Select the affected release.
  5. Choose Uninstall.
  6. Follow the MathWorks installer prompts.
  7. Download the same release from the official MathWorks Downloads page.
  8. Install it again using an account or license authorized for that release.
  9. Restart Windows.
  10. Open MATLAB and test plotting.

If the MathWorks installer offers a repair option, use repair first. If repair is unavailable or the error returns, uninstall and reinstall the same release.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Windows 10

  1. Close MATLAB.
  2. Select Start > Settings > Apps > Apps & features.
  3. Select the affected MATLAB release.
  4. Choose Uninstall.
  5. Download the required release from MathWorks.
  6. Install it again.
  7. Restart Windows and test MATLAB graphics.

Do not delete individual files from the MATLAB folder while attempting a repair. MATLAB components are versioned and depend on matching libraries and resource files.

Fix 3: Reinstall the matching MATLAB Runtime

Use this fix when a compiled MATLAB application fails but MATLAB is not installed.

  1. Find the application’s readme.txt, installer notes, or publisher documentation.
  2. Identify the exact MATLAB Runtime release.
  3. Confirm whether the application needs win32 or win64.
  4. Download that release from the official MathWorks MATLAB Runtime page.
  5. Extract the downloaded ZIP file.
  6. Open the extracted folder.
  7. Right-click setup.exe and select Run as administrator.
  8. Complete the installation.
  9. Restart Windows.
  10. Open the affected application again.

If the same MATLAB Runtime release is already installed, reinstalling it can overwrite damaged runtime files.

If MATLAB itself opens, the MATLAB command below can download a runtime installer corresponding to the current MATLAB release and update level:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
compiler.runtime.download

This does not identify the correct runtime for every third-party application. For a compiled application, the publisher’s stated release remains the authority.

Fix 4: Check for a missing resource or broken MATLAB path

If hg.dll exists but MATLAB reports graphics initialization errors, check whether the related resource is present.

  1. Close MATLAB.
  2. Open the MATLAB installation folder.
  3. Browse to:

text
toolboxmatlabgraphicscorehg

  1. Check for hgrc.m.
  2. If it is missing, repair or reinstall MATLAB.
  3. If it exists, start MATLAB and inspect whether the MATLAB path was changed.
  4. Reset the MATLAB path using MATLAB’s path-management tools.
  5. Restart MATLAB and test a plot.

Do not copy hgrc.m or hg.dll from another computer. The file may belong to a different release or update and may not match the rest of the installation.

A broken PATH can also prevent MATLAB Runtime libraries from being found. This is especially relevant when multiple MATLAB Runtime releases are installed. Follow the runtime path instructions supplied with the application and avoid replacing system-wide environment variables without recording their existing values.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Fix 5: Check antivirus quarantine

Antivirus software can quarantine a genuine MATLAB file, particularly after a scan, update, or installation change.

  1. Open Windows Security.
  2. Select Virus & threat protection.
  3. Choose Protection history.
  4. Look for an event involving hg.dll or the MATLAB installation folder.
  5. Check the file path and publisher information.
  6. Restore the file only if it clearly belongs to the genuine MathWorks installation.
  7. Run a full antivirus scan.
  8. Repair or reinstall MATLAB or MATLAB Runtime afterward if the file was removed.

Do not permanently disable protection to make the application start. If security software repeatedly removes the file, contact your security vendor and MathWorks or the application publisher before adding an exclusion.

Fix 6: Repair broader Windows components

Windows repair commands are useful when several unrelated programs are failing, Windows updates are damaged, or system files show broader corruption. They are not the primary repair for a MathWorks-owned hg.dll.

Rank #2
  1. Open Start.
  2. Type Command Prompt.
  3. Right-click Command Prompt.
  4. Select Run as administrator.
  5. Run:

text
DISM.exe /Online /Cleanup-image /Restorehealth

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Wait for it to finish.
  2. Run:

text
sfc /scannow

  1. Restart Windows.
  2. Test MATLAB or the MATLAB-based application again.

Microsoft documents these commands through its System File Checker guidance. SFC and DISM normally repair Windows components, not files inside a MATLAB installation. If only MATLAB fails, reinstall MATLAB instead of repeatedly running system repair commands.

When manually hunting through Windows components and repeating SFC or DISM does not reveal what changed, Outbyte PC Repair can scan for system issues and show what needs attention; repairs are performed by the full version, and it is not required for a MATLAB-specific reinstall.

Fix 7: Check display drivers only when graphics problems are broader

A display driver is not the normal source of a missing hg.dll message. However, update the graphics driver when MATLAB opens but rendering fails across multiple applications, the screen flashes, or other graphics programs show similar problems.

Check the installed driver

  1. Right-click Start.
  2. Select Device Manager.
  3. Expand Display adapters.
  4. Right-click the graphics adapter.
  5. Select Properties.
  6. Open the Driver tab.
  7. Note the provider, date, and version.
  8. Visit the graphics hardware manufacturer’s official support page.
  9. Install the driver intended for your Windows version and architecture.
  10. Restart Windows and test MATLAB.

Do not replace hg.dll as a substitute for a display-driver repair. If you have several adapters or are unsure which driver applies, Outbyte Driver Updater can scan and identify stale drivers; the driver installation is performed by the full version, while reinstalling the MATLAB product remains the definitive fix for an application-specific hg.dll error.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Fix 8: Verify Windows architecture and application architecture

A 64-bit MATLAB or MATLAB Runtime installation cannot be repaired with a random 32-bit DLL. Likewise, a 32-bit application may require win32.

To check Windows:

  1. Open Start > Settings > System > About.
  2. Find System type.
  3. Record whether Windows is 64-bit or 32-bit.

To check the application, consult its installer, documentation, readme.txt, or publisher. Some older applications identify their architecture in the installation folder or executable properties.

Install the matching MATLAB Runtime architecture. Do not assume that installing both architectures solves the problem, and do not place a 32-bit file in a 64-bit MATLAB folder.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Fix 9: Check whether the MATLAB folder was moved or partially deleted

MATLAB may fail after a folder is moved, cloned, cleaned, restored from backup, or removed by a disk-cleanup utility.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Look for these symptoms:

  • hg.dll is absent from the expected binwin64 or binwin32 folder
  • MATLAB reports that hgrc.m cannot be found
  • The error began after uninstalling an older release
  • The application starts only when launched from a particular folder
  • The runtime is installed but the application cannot locate it

Restore the original installation location if possible. Otherwise, perform a clean reinstall from the official MathWorks installer. Recreating folders and copying individual files is not a reliable repair.

Why copying hg.dll does not usually work

A loose DLL may be:

  • From a different MATLAB release
  • The wrong architecture
  • Missing dependent libraries
  • Missing matching MATLAB resource files
  • Altered or malicious
  • Installed in a directory that changes Windows DLL search behavior

The message “The specified module could not be found” can also mean that hg.dll exists but one of its dependencies does not. Replacing the named file alone does not resolve that condition.

Never copy hg.dll into:

C:WindowsSystem32
C:WindowsSysWOW64

Do not place it in an unrelated application directory. Microsoft explains the risks of unintended DLL loading in its documentation about DLL search order and DLL security.

Why regsvr32 is not the fix

Do not run:

regsvr32 hg.dll

regsvr32 is intended for COM, OLE, or ActiveX DLLs that provide the required registration entry points. There is no evidence that MATLAB’s hg.dll is a COM server. Registering it will not restore MATLAB resources, repair the runtime, or fix a missing dependency.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Microsoft explains the command’s purpose in its regsvr32 documentation.

Match the error to the likely cause

Message or symptom Likely cause Correct next step
hg.dll is missing from your computer Damaged MATLAB installation or missing MATLAB Runtime Repair the owning product
hg.dll was not found Wrong release, architecture, or search path Identify the required runtime and architecture
The specified module could not be found hg.dll or one of its dependencies is missing Reinstall the complete product
hg.dll is either not designed to run on Windows or it contains an error Wrong, corrupted, or incompatible DLL Remove the replacement and reinstall MATLAB or Runtime
Error occurred during graphics initialization Missing hgrc.m, broken path, or damaged graphics files Repair MATLAB and reset its path
MATLAB opens but plotting fails Graphics resources or installation are damaged Repair the same MATLAB release
A standalone app fails without MATLAB installed MATLAB Runtime is absent or mismatched Install the runtime release used to compile it

When to contact support

Contact MathWorks when:

  • A same-release reinstall does not restore MATLAB
  • MATLAB reports missing graphics resources after installation
  • Multiple MATLAB releases interfere with one another
  • License, installer, or path configuration errors continue

Contact the application publisher when:

  • A compiled application does not identify its MATLAB Runtime release
  • Its installer fails to install the runtime
  • The application requires a private runtime configuration
  • The publisher supplied the wrong architecture or package

Contact Microsoft or your computer manufacturer when several unrelated Windows applications fail and DISM/SFC report broader corruption.

FAQ

Is hg.dll a Windows file?

No. hg.dll is associated with MATLAB and MATLAB Runtime. Windows Update, Visual C++ Redistributables, DirectX, and .NET do not normally supply it.

Do I need MATLAB if I only use one compiled application?

Usually not. A compiled MATLAB application generally needs the matching MATLAB Runtime instead. The required release is determined by the MATLAB release used to compile the application.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Can I install the newest MATLAB Runtime?

Not automatically. MATLAB Runtime is release-specific. Install the release identified by the application publisher or its documentation.

Should I download hg.dll from a DLL website?

No. A downloaded copy may contain malware, use the wrong architecture, or fail because matching libraries and resource files are missing. Restore the complete MATLAB or MATLAB Runtime installation from MathWorks.

What if hg.dll is present but the error remains?

A dependency or MATLAB resource may be missing. Check for hgrc.m, review the MATLAB installation path, and repair or reinstall the complete product.

Will SFC restore hg.dll?

Normally no. SFC repairs protected Windows components. A MathWorks-owned file should be restored by repairing or reinstalling MATLAB or MATLAB Runtime.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Does regsvr32 fix hg.dll?

No. regsvr32 is not a general DLL repair command and is normally irrelevant to MATLAB’s graphics library.

Where should hg.dll normally be located?

For MATLAB, look under a release folder such as:

...MATLABR20XXybinwin64

For MATLAB Runtime, look under a release-specific folder such as:

...MATLAB RuntimeRxxbinwin64

Older 32-bit installations may use win32. The correct location depends on the product, release, and architecture.

Quick Recap

SaleBestseller No. 1
Microsoft Windows 11 (USB)
Microsoft Windows 11 (USB)
Make the most of your screen space with snap layouts, desktops, and seamless redocking.; FPP is boxed product that ships with USB for installation
$128.99
SaleBestseller No. 2

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How To Create Custom Stickers & Shoutouts In Monster Hunter WildsMonster Hunter WildsBlog20min
  2. How to Get XL Gogoat in Pokemon Legends Z-A (An Extra-Large Gogoat)Pokemon Legends Z-ABlog20min
  3. How to Get Rotting Lightbringer in Diablo 4Diablo 4Blog17min
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.