Start with this diagnostic checklist
Before changing Windows files, answer these three questions:
- Which program fails? Is it MATLAB, or a standalone application built with MATLAB Compiler?
- When does it fail? Does the program refuse to start, or does MATLAB open but fail during plotting, graphics initialization, or App Designer use?
- 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.
| # | Preview | Product | Price | |
|---|---|---|---|---|
| 1 |
|
Microsoft Windows 11 (USB) | $128.99 | Buy on Amazon |
| 2 |
|
Tech-Shop-pro Compatible with install Key Included USB For Windows 11 Home OEM Version 64 bit.... | $48.00 | Buy on Amazon |
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.
#1 Best Overall
- 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.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Fix 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.
- Close MATLAB and any MATLAB-based applications.
- Open File Explorer.
- Browse to:
text
C:Program FilesMATLAB
- Open the folder for the affected release.
- Check whether
binwin64hg.dllexists. - If MATLAB opens, test graphics by running a simple plot.
- 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:
- 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
- Save your MATLAB work and close MATLAB.
- Select Start > Settings > Apps > Installed apps.
- Search for MATLAB.
- Select the affected release.
- Choose Uninstall.
- Follow the MathWorks installer prompts.
- Download the same release from the official MathWorks Downloads page.
- Install it again using an account or license authorized for that release.
- Restart Windows.
- 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.
Recommended Free Tools
Windows 10
- Close MATLAB.
- Select Start > Settings > Apps > Apps & features.
- Select the affected MATLAB release.
- Choose Uninstall.
- Download the required release from MathWorks.
- Install it again.
- 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.
- Find the application’s
readme.txt, installer notes, or publisher documentation. - Identify the exact MATLAB Runtime release.
- Confirm whether the application needs
win32orwin64. - Download that release from the official MathWorks MATLAB Runtime page.
- Extract the downloaded ZIP file.
- Open the extracted folder.
- Right-click
setup.exeand select Run as administrator. - Complete the installation.
- Restart Windows.
- 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:
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minutecompiler.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.
- Close MATLAB.
- Open the MATLAB installation folder.
- Browse to:
text
toolboxmatlabgraphicscorehg
- Check for
hgrc.m. - If it is missing, repair or reinstall MATLAB.
- If it exists, start MATLAB and inspect whether the MATLAB path was changed.
- Reset the MATLAB path using MATLAB’s path-management tools.
- 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.
Fix 5: Check antivirus quarantine
Antivirus software can quarantine a genuine MATLAB file, particularly after a scan, update, or installation change.
- Open Windows Security.
- Select Virus & threat protection.
- Choose Protection history.
- Look for an event involving
hg.dllor the MATLAB installation folder. - Check the file path and publisher information.
- Restore the file only if it clearly belongs to the genuine MathWorks installation.
- Run a full antivirus scan.
- 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
- Video Link to instructions and Free support VIA Amazon
- Great Support fast responce
- 15 plus years of experiance
- Key is included
- Open Start.
- Type
Command Prompt. - Right-click Command Prompt.
- Select Run as administrator.
- Run:
text
DISM.exe /Online /Cleanup-image /Restorehealth
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →- Wait for it to finish.
- Run:
text
sfc /scannow
- Restart Windows.
- 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
- Right-click Start.
- Select Device Manager.
- Expand Display adapters.
- Right-click the graphics adapter.
- Select Properties.
- Open the Driver tab.
- Note the provider, date, and version.
- Visit the graphics hardware manufacturer’s official support page.
- Install the driver intended for your Windows version and architecture.
- 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.
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:
- Open Start > Settings > System > About.
- Find System type.
- 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.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.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Look for these symptoms:
hg.dllis absent from the expectedbinwin64orbinwin32folder- MATLAB reports that
hgrc.mcannot 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.
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.
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.
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
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.




