* INCLUSION CRITERIA:
* Participants must have a clinical diagnosis of a large and giant congenital melanocytic nevi (LGCMN).
* Participants must have a documented history of somatic pathogenic or likely pathogenic variation in NRAS or BRAF, or a pathogenic fusion in which one of the fusion partners is ALK, NTRK1, BRAF, or RAF1. Participants who do not have documented history will be tested by NSR device (via next-generation sequencing panel TruSight(TM) Oncology 500)
* Participants must have: at least one nevus \> 20 cm
OR
at least one nevus with a projected adult diameter \> 20 cm (participants \< 18 years old).
Note: Participants who have had prior surgical treatment of their LGCMN, but the remaining nevus has a diameter \> 20 cm, are eligible for enrollment.
* Age \>= 3 years and \<= 40 years old.
* Participants must have a Body Surface Area (BSA) \>= 0.4 m\^2.
* Clinical performance status: Karnofsky \>= 70% (\>= 16 years); Lansky scale \>=70% (\< 16 years).
* Participants must have adequate organ and marrow function as defined below:
* Hemoglobin \>= 11 g/dL
* Absolute neutrophil count \>= 1,000/mcL
* Platelets \>= 100,000/mcL
* Total bilirubin \<= 1.5 X institutional upper limit of normal (ULN) for age. Note: 3 X ULN for age for participants with Gilbert syndrome
* Aspartate Aminotransferase (AST) \<= 3 X institutional ULN
* Alanine Aminotransferase (ALT) \<= 3 X institutional ULN
* Estimated creatinine clearance \>= 30 mL/min/1.73 m\^2 as calculated per the 2021 Chronic Kidney Disease Epidemiology Collaboration (CKD-EPI) equation (\>= 18 years old) or Chronic Kidney Disease in Children Under 25 (CKiD U25) in (\< 18 years old)
* Cardiac function: Normal ejection fraction (echocardiogram \[ECHO\] or cardiac MRI), defined as ejection fraction (EF) \>= 53%; normal QTc interval, defined as QTcF \<= 450 msec
* Blood pressure (BP):
Adults (\>= 18 years old): BP \<= 130 systolic and \<= 80 diastolic
Children (\< 18 years old): BP \<= the 95th percentile for age, height, and sex
Adequate blood pressure can be achieved using medication for the treatment of hypertension.
--Serum creatine phosphokinase (CPK) \<= 2.5 X institutional ULN
* Participants with neurocutaneous melanocytosis must be asymptomatic and have nonprogressive disease.
* Participants with seizure disorder may be enrolled if on anticonvulsants, and there has been no change to their anticonvulsant medication in the 4 weeks prior to the study treatment initiation, and the participant has been seizure-free during that time.
* Human immunodeficiency virus (HIV)-infected participants on effective anti-retroviral therapy must have an undetectable viral load.
* Participants with evidence of chronic hepatitis B virus (HBV) infection must have an undetectable HBV viral load and be on suppressive therapy, if indicated.
* Participants with evidence of hepatitis C virus (HCV) infection must have an undetectable HCV viral load and be cured or on suppressive therapy, if indicated.
* Women who are nursing or plan to nurse a child must agree to discontinue/postpone nursing while taking mirdametinib and until 1 week after the administration of the last dose of mirdametinib.
* Women of child-bearing potential (WOCBP) must agree to use an effective contraception (barrier, hormonal, intrauterine device, surgical sterilization, continuous abstinence) while taking mirdametinib and until 6 weeks after administration of the last dose of mirdametinib. A participant may request a male partner to use an effective form of contraception to fulfill this requirement.
Note: WOCBP defined as:
* biologically female sex with a uterus and at least one ovary who is at least Tanner Stage 3, AND
* entered puberty and has not completed menopause AND
* does not meet the definition of female participant who cannot get pregnant as follows:
* has undergone a hysterectomy OR
* has undergone a bilateral oophorectomy OR
* has completed menopause defined as 12 months of spontaneous amenorrhea or 6 months of spontaneous amenorrhea with serum FSH levels \> 40 mIU/ml or 6 weeks postsurgical OR
* has not gone through menarche or reached Tanner Stage 3
Men (biologically male sex) must agree to use an effective method of contraception (barrier, surgical sterilization, abstinence) while taking mirdametinib and until 3 months after administration of the last dose of mirdametinib. A participant may request a female partner to use an effective form of contraception to fulfill this requirement. Men must not freeze or donate sperm within the same period.
-Ability of participant or parent/guardian to understand and the willingness to sign a written informed consent document.
EXCLUSION CRITERIA:
* Participants who are receiving any investigational agents within the 30 days prior to the study treatment initiation.
* History of allergic reactions attributed to compounds of similar chemical or biologic composition to mirdametinib.
* Prior treatment with mirdametinib or another specific MEK1/2 inhibitor.
* Ophthalmologic conditions:
* Current or history of central serous retinopathy
* Current or history of retinal vein occlusion
* Known intraocular pressure (IOP) \> 21 mmHg (or ULN adjusted by age) or uncontrolled glaucoma (irrespective of IOP).
* Ophthalmologic findings secondary to long-standing optic pathway glioma or NCM (such as visual loss, optic nerve pallor, or strabismus) will NOT be considered a significant abnormality for the purposes of the study.
* Cardiac conditions:
* Heart failure (any New York Heart Association \[NYHA\] class)
* Myocardial infarction, severe/unstable angina, coronary or peripheral artery bypass graft placement, cerebrovascular accident, transient ischemic attack, or symptomatic pulmonary embolism within 6 months prior to starting study treatment.
* Refractory nausea and vomiting, chronic gastrointestinal disease (e.g., inflammatory bowel disease), or significant bowel resection that would preclude adequate absorption of mirdametinib.
* Any unresolved chronic toxicity grade \>= 2 per CTCAE from previous therapy, except for alopecia.
* History of renal transplant.
* Major surgery within 4 weeks prior to starting study treatment.
* Prior history of melanoma or other malignancy.
* Active infection (currently on treatment with anti-microbials).
* Positive serum or urine beta-human chorionic gonadotropin (beta-HCG) pregnancy test performed at screening.
* Uncontrolled, symptomatic intercurrent illness evaluated by medical history, physical exam, lab evaluations that would unacceptably increase risk for the participant or impair the ability to evaluate the endpoints of the study.